pg schema

db_lei2=# select * from information_schema.schemata;
 catalog_name |    schema_name     | schema_owner | default_character_set_catalog | default_character_set_schema | default_character_set_name | sql_path 
--------------+--------------------+--------------+-------------------------------+------------------------------+----------------------------+----------
 db_lei2      | s_lei_2            | pg102        |                               |                              |                            | 
 db_lei2      | information_schema | pg102        |                               |                              |                            | 
 db_lei2      | public             | pg102        |                               |                              |                            | 
 db_lei2      | pg_catalog         | pg102        |                               |                              |                            | 
 db_lei2      | pg_toast_temp_1    | pg102        |                               |                              |                            | 
 db_lei2      | pg_temp_1          | pg102        |                               |                              |                            | 
 db_lei2      | pg_toast           | pg102        |                               |                              |                            | 
(7 rows)

db_lei2=# select * from pg_namespace;
      nspname       | nspowner |           nspacl           
--------------------+----------+----------------------------
 pg_toast           |       10 | 
 pg_temp_1          |       10 | 
 pg_toast_temp_1    |       10 | 
 pg_catalog         |       10 | {pg102=UC/pg102,=U/pg102}
 public             |       10 | {pg102=UC/pg102,=UC/pg102}
 information_schema |       10 | {pg102=UC/pg102,=U/pg102}
 s_lei_2            |       10 | 
(7 rows)

db_lei2=# select oid,* from pg_namespace;
  oid  |      nspname       | nspowner |           nspacl           
-------+--------------------+----------+----------------------------
    99 | pg_toast           |       10 | 
 11736 | pg_temp_1          |       10 | 
 11737 | pg_toast_temp_1    |       10 | 
    11 | pg_catalog         |       10 | {pg102=UC/pg102,=U/pg102}
  2200 | public             |       10 | {pg102=UC/pg102,=UC/pg102}
 12921 | information_schema |       10 | {pg102=UC/pg102,=U/pg102}
 40967 | s_lei_2            |       10 | 
(7 rows)

db_lei2=# 
db_lei2=# select * from pg_authid where oid=10;
 rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolbypassrls | rolconnlimit | rolpassword | rolvaliduntil 
---------+----------+------------+---------------+-------------+-------------+----------------+--------------+--------------+-------------+---------------
 pg102   | t        | t          | t             | t           | t           | t              | t            |           -1 |             | 
(1 row)

db_lei2=# select SELECT pg_relation_filepath('pg_db_role_setting');
ERROR:  syntax error at or near "SELECT"
LINE 1: select SELECT pg_relation_filepath('pg_db_role_setting');
               ^
db_lei2=# SELECT pg_relation_filepath('pg_db_role_setting');
 pg_relation_filepath 
----------------------
 global/2964
(1 row)

db_lei2=# SELECT pg_relation_filepath('pg_class');
 pg_relation_filepath 
----------------------
 base/40966/1259
(1 row)

db_lei2=# SELECT pg_relation_filepath('pg_authid');
 pg_relation_filepath 
----------------------
 global/1260
(1 row)

db_lei2=# SELECT pg_relation_filepath('pg_roles');
 pg_relation_filepath 
----------------------
 
(1 row)

db_lei2=# SELECT pg_relation_filepath('pg_namespace');
 pg_relation_filepath 
----------------------
 base/40966/2615
(1 row)

db_lei2=# SELECT pg_relation_filepath('information_schema.schemata');
 pg_relation_filepath 
----------------------
 
(1 row)

db_lei2=# SELECT pg_relation_filepath('schemata');
ERROR:  relation "schemata" does not exist
LINE 1: SELECT pg_relation_filepath('schemata');
                                    ^
db_lei2=# 
db_lei2=#
[pg102@pgserver ~]$ psql -p 5532 -d postgres
psql (10.2)
Type "help" for help.

postgres=# \set ECHO_HIDDEN on
postgres=# \dnS+
********* QUERY **********
SELECT n.nspname AS "Name",pg_catalog.pg_get_userbyid(n.nspowner) AS "Owner",pg_catalog.array_to_string(n.nspacl,E'\n') AS "Access privileges",pg_catalog.obj_description(n.oid,'pg_namespace') AS "Description"
FROM pg_catalog.pg_namespace n
ORDER BY 1;
**************************

                                  List of schemas
        Name        | Owner | Access privileges |           Description            
--------------------+-------+-------------------+----------------------------------
 information_schema | pg102 | pg102=UC/pg102   +| 
                    |       | =U/pg102          | 
 pg_catalog         | pg102 | pg102=UC/pg102   +| system catalog schema
                    |       | =U/pg102          | 
 pg_temp_1          | pg102 |                   | 
 pg_toast           | pg102 |                   | reserved schema for TOAST tables
 pg_toast_temp_1    | pg102 |                   | 
 public             | pg102 | pg102=UC/pg102   +| standard public schema
                    |       | =UC/pg102         | 
(6 rows)

postgres=#

相关文章

文章浏览阅读601次。Oracle的数据导入导出是一项基本的技能,...
文章浏览阅读553次。开头还是介绍一下群,如果感兴趣polardb...
文章浏览阅读3.5k次,点赞3次,收藏7次。折腾了两个小时多才...
文章浏览阅读2.7k次。JSON 代表 JavaScript Object Notation...
文章浏览阅读2.9k次,点赞2次,收藏6次。navicat 连接postgr...
文章浏览阅读1.4k次。postgre进阶sql,包含分组排序、JSON解...