pg schema

前端之家收集整理的这篇文章主要介绍了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=#
原文链接:https://www.f2er.com/postgresql/193092.html

猜你在找的Postgre SQL相关文章