postgres=# select * from pg_namespace; -- oid 값이 안보이네요.
nspname | nspowner | nspacl
--------------------+----------+-------------------------------------
pg_catalog | 10 | {postgres=UC/postgres,=U/postgres}
public | 10 | {postgres=UC/postgres,=UC/postgres}
information_schema | 10 | {postgres=UC/postgres,=U/postgres}
postgres=# select oid, * from pg_namespace;
oid | nspname | nspowner | nspacl
-------+--------------------+----------+-------------------------------------
11195 | pg_toast_temp_1 | 10 |
11 | pg_catalog | 10 | {postgres=UC/postgres,=U/postgres}
2200 | public | 10 | {postgres=UC/postgres,=UC/postgres}
11459 | information_schema | 10 | {postgres=UC/postgres,=U/postgres}
참고) pg_namespace
Name |
Type |
References |
Description |
oid |
oid |
|
Row identifier (hidden attribute; must be explicitly selected) |
nspname |
name |
|
Name of the namespace |
nspowner |
oid |
pg_authid.oid |
Owner of the namespace |
nspacl |
aclitem[] |
|
Access privileges; see GRANT and REVOKE for details |
아래 쿼리로 스키마와 해당 스키마 owner 를 매칭시킬수 있습니다.
postgres=# select x.oid schema_id, x.nspname schema_name, x.nspowner userid, y.
usename username from pg_namespace x inner join pg_user y
on x.nspowner=y.usesys
id;
schema_id | schema_name | userid | username
-----------+--------------------+--------+----------
99 | pg_toast | 10 | postgres
11194 | pg_temp_1 | 10 | postgres
11195 | pg_toast_temp_1 | 10 | postgres
11 | pg_catalog | 10 | postgres
2200 | public | 10 | postgres
11459 | information_schema | 10 | postgres
(6 rows)
postgres=#