pg_namespace

包含模式定义的系统表

pg_namespace 是一个包含模式定义的 系统目录 表。

pg_namespacePostgreSQL 7.3 中引入。

psql 命令

  • \dn 列出可用的模式

PostgreSQL 版本定义

pg_namespace (PostgreSQL 17)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 oid      | oid       |           | not null | 
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_oid_index" PRIMARY KEY, btree (oid)
    "pg_namespace_nspname_index" UNIQUE CONSTRAINT, btree (nspname)
    

文档: pg_namespace

pg_namespace (PostgreSQL 16)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 oid      | oid       |           | not null | 
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_oid_index" PRIMARY KEY, btree (oid)
    "pg_namespace_nspname_index" UNIQUE CONSTRAINT, btree (nspname)
    

文档: pg_namespace

pg_namespace (PostgreSQL 15)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 oid      | oid       |           | not null | 
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_oid_index" PRIMARY KEY, btree (oid)
    "pg_namespace_nspname_index" UNIQUE CONSTRAINT, btree (nspname)
    

文档: pg_namespace

pg_namespace (PostgreSQL 14)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 oid      | oid       |           | not null | 
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_oid_index" PRIMARY KEY, btree (oid)
    "pg_namespace_nspname_index" UNIQUE CONSTRAINT, btree (nspname)
    

文档: pg_namespace

pg_namespace (PostgreSQL 13)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 oid      | oid       |           | not null | 
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 12)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 oid      | oid       |           | not null | 
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 11)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 10)

            Table "pg_catalog.pg_namespace"
  Column  |   Type    | Collation | Nullable | Default 
----------+-----------+-----------+----------+---------
 nspname  | name      |           | not null | 
 nspowner | oid       |           | not null | 
 nspacl   | aclitem[] |           |          | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.6)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.5)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.4)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.3)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.2)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.1)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 9.0)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 8.4)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 8.3)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

pg_namespace (PostgreSQL 8.2)

 Table "pg_catalog.pg_namespace"
  Column  |   Type    | Modifiers 
----------+-----------+-----------
 nspname  | name      | not null
 nspowner | oid       | not null
 nspacl   | aclitem[] | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
    

文档: pg_namespace

更改历史记录

自它在 PostgreSQL 7.3 中添加以来,此表未被修改。

例子

postgres=# CREATE SCHEMA someschema;
CREATE SCHEMA
postgres=# \dn List of schemas Name | Owner ------------+---------- public | postgres someschema | postgres (2 rows) postgres=# SELECT * FROM pg_namespace; nspname | nspowner | nspacl --------------------+----------+------------------------------------- pg_toast | 10 | pg_temp_1 | 10 | pg_toast_temp_1 | 10 | pg_catalog | 10 | {postgres=UC/postgres,=U/postgres} public | 10 | {postgres=UC/postgres,=UC/postgres} information_schema | 10 | {postgres=UC/postgres,=U/postgres} someschema | 10 | (7 rows)

类别

模式 (命名空间), 系统目录

另请参阅

CREATE SCHEMA, ALTER SCHEMA, DROP SCHEMA, pg_default_acl

反馈

提交关于 "pg_namespace" 的任何评论、建议或更正 这里.