pg_foreign_table

包含外部表元数据的系统表

pg_foreign_table 是一个包含外部表元数据的系统目录表。

pg_foreign_table 添加于PostgreSQL 9.1

psql 命令

\dE\det 列出外部表。

按 PostgreSQL 版本定义

pg_foreign_table (PostgreSQL 17)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] | C         |          | 
Indexes:
    "pg_foreign_table_relid_index" PRIMARY KEY, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 16)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] | C         |          | 
Indexes:
    "pg_foreign_table_relid_index" PRIMARY KEY, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 15)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] | C         |          | 
Indexes:
    "pg_foreign_table_relid_index" PRIMARY KEY, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 14)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] | C         |          | 
Indexes:
    "pg_foreign_table_relid_index" PRIMARY KEY, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 13)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] | C         |          | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 12)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] | C         |          | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 11)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] |           |          | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 10)

         Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Collation | Nullable | Default 
-----------+--------+-----------+----------+---------
 ftrelid   | oid    |           | not null | 
 ftserver  | oid    |           | not null | 
 ftoptions | text[] |           |          | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 9.6)

Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Modifiers 
-----------+--------+-----------
 ftrelid   | oid    | not null
 ftserver  | oid    | not null
 ftoptions | text[] | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 9.5)

Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Modifiers 
-----------+--------+-----------
 ftrelid   | oid    | not null
 ftserver  | oid    | not null
 ftoptions | text[] | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 9.4)

Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Modifiers 
-----------+--------+-----------
 ftrelid   | oid    | not null
 ftserver  | oid    | not null
 ftoptions | text[] | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 9.3)

Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Modifiers 
-----------+--------+-----------
 ftrelid   | oid    | not null
 ftserver  | oid    | not null
 ftoptions | text[] | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 9.2)

Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Modifiers 
-----------+--------+-----------
 ftrelid   | oid    | not null
 ftserver  | oid    | not null
 ftoptions | text[] | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

pg_foreign_table (PostgreSQL 9.1)

Table "pg_catalog.pg_foreign_table"
  Column   |  Type  | Modifiers 
-----------+--------+-----------
 ftrelid   | oid    | not null
 ftserver  | oid    | not null
 ftoptions | text[] | 
Indexes:
    "pg_foreign_table_relid_index" UNIQUE, btree (ftrelid)
    

文档: pg_foreign_table

更改历史记录

自添加于PostgreSQL 9.1以来,此表未被修改过。

示例

postgres=# CREATE FOREIGN TABLE foo_remote (id INT)
   SERVER fdw_test
   OPTIONS(table_name 'foo');
CREATE FOREIGN TABLE

postgres=# SELECT * FROM pg_foreign_table;
 ftrelid | ftserver |    ftoptions
---------+----------+------------------
   16482 |    16459 | {table_name=foo}
(1 row)

分类

DDL外部数据包装器 (FDW)系统目录

另请参见

pg_classpg_foreign_server

反馈

提交关于"pg_foreign_table" 的任何评论、建议或更正 此处