Display both per-table and per-column FDW options in psql's \d output.

Along the way, rename "Options" to "FDW Options" in various places for
consistency and clarity.

Shigeru Hanada
This commit is contained in:
Robert Haas 2011-08-11 11:45:47 -04:00
parent 5057366eed
commit d82d84864c
3 changed files with 92 additions and 78 deletions

View File

@ -892,15 +892,14 @@ testdb=>
<para> <para>
For some types of relation, <literal>\d</> shows additional information For some types of relation, <literal>\d</> shows additional information
for each column: column values for sequences, indexed expression for for each column: column values for sequences, indexed expression for
indexes and per-column foreign data wrapper options for foreign tables. indexes and foreign data wrapper options for foreign tables.
</para> </para>
<para> <para>
The command form <literal>\d+</literal> is identical, except that The command form <literal>\d+</literal> is identical, except that
more information is displayed: any comments associated with the more information is displayed: any comments associated with the
columns of the table are shown, as is the presence of OIDs in the columns of the table are shown, as is the presence of OIDs in the
table, the view definition if the relation is a view, and the generic table, the view definition if the relation is a view.
options if the relation is a foreign table.
</para> </para>
<para> <para>

View File

@ -1367,7 +1367,7 @@ describeOneTableDetails(const char *schemaname,
headers[cols++] = gettext_noop("Definition"); headers[cols++] = gettext_noop("Definition");
if (tableinfo.relkind == 'f' && pset.sversion >= 90200) if (tableinfo.relkind == 'f' && pset.sversion >= 90200)
headers[cols++] = gettext_noop("Options"); headers[cols++] = gettext_noop("FDW Options");
if (verbose) if (verbose)
{ {
@ -2033,9 +2033,12 @@ describeOneTableDetails(const char *schemaname,
/* print foreign server name */ /* print foreign server name */
if (tableinfo.relkind == 'f') if (tableinfo.relkind == 'f')
{ {
char *ftoptions;
/* Footer information about foreign table */ /* Footer information about foreign table */
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT s.srvname\n" "SELECT s.srvname,\n"
" f.ftoptions\n"
"FROM pg_catalog.pg_foreign_table f,\n" "FROM pg_catalog.pg_foreign_table f,\n"
" pg_catalog.pg_foreign_server s\n" " pg_catalog.pg_foreign_server s\n"
"WHERE f.ftrelid = %s AND s.oid = f.ftserver;", "WHERE f.ftrelid = %s AND s.oid = f.ftserver;",
@ -2049,9 +2052,18 @@ describeOneTableDetails(const char *schemaname,
goto error_return; goto error_return;
} }
/* Print server name */
printfPQExpBuffer(&buf, "Server: %s", printfPQExpBuffer(&buf, "Server: %s",
PQgetvalue(result, 0, 0)); PQgetvalue(result, 0, 0));
printTableAddFooter(&cont, buf.data); printTableAddFooter(&cont, buf.data);
/* Print per-table FDW options, if any */
ftoptions = PQgetvalue(result, 0, 1);
if (ftoptions && ftoptions[0] != '\0')
{
printfPQExpBuffer(&buf, "FDW Options: %s", ftoptions);
printTableAddFooter(&cont, buf.data);
}
PQclear(result); PQclear(result);
} }
@ -3668,7 +3680,7 @@ listForeignDataWrappers(const char *pattern, bool verbose)
printACLColumn(&buf, "fdwacl"); printACLColumn(&buf, "fdwacl");
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
",\n fdwoptions AS \"%s\"", ",\n fdwoptions AS \"%s\"",
gettext_noop("Options")); gettext_noop("FDW Options"));
if (pset.sversion >= 90100) if (pset.sversion >= 90100)
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
@ -3744,7 +3756,7 @@ listForeignServers(const char *pattern, bool verbose)
" d.description AS \"%s\"", " d.description AS \"%s\"",
gettext_noop("Type"), gettext_noop("Type"),
gettext_noop("Version"), gettext_noop("Version"),
gettext_noop("Options"), gettext_noop("FDW Options"),
gettext_noop("Description")); gettext_noop("Description"));
} }
@ -3807,7 +3819,7 @@ listUserMappings(const char *pattern, bool verbose)
if (verbose) if (verbose)
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
",\n um.umoptions AS \"%s\"", ",\n um.umoptions AS \"%s\"",
gettext_noop("Options")); gettext_noop("FDW Options"));
appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_user_mappings um\n"); appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_user_mappings um\n");
@ -3863,7 +3875,7 @@ listForeignTables(const char *pattern, bool verbose)
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,
",\n ft.ftoptions AS \"%s\",\n" ",\n ft.ftoptions AS \"%s\",\n"
" d.description AS \"%s\"", " d.description AS \"%s\"",
gettext_noop("Options"), gettext_noop("FDW Options"),
gettext_noop("Description")); gettext_noop("Description"));
appendPQExpBuffer(&buf, appendPQExpBuffer(&buf,

View File

@ -53,7 +53,7 @@ DROP FOREIGN DATA WRAPPER foo;
CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1'); CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1');
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+-------------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | {testing=1} | foo | foreign_data_user | - | - | | {testing=1} |
@ -66,7 +66,7 @@ ERROR: option "testing" provided more than once
CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1', another '2'); CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1', another '2');
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+-----------------------+------------- ------------+-------------------+---------+--------------------------+-------------------+-----------------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | {testing=1,another=2} | foo | foreign_data_user | - | - | | {testing=1,another=2} |
@ -81,12 +81,12 @@ HINT: Must be superuser to create a foreign-data wrapper.
RESET ROLE; RESET ROLE;
CREATE FOREIGN DATA WRAPPER foo VALIDATOR postgresql_fdw_validator; CREATE FOREIGN DATA WRAPPER foo VALIDATOR postgresql_fdw_validator;
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+---------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | postgresql_fdw_validator | | | foo | foreign_data_user | - | postgresql_fdw_validator | | |
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(3 rows) (3 rows)
-- ALTER FOREIGN DATA WRAPPER -- ALTER FOREIGN DATA WRAPPER
@ -98,12 +98,12 @@ ALTER FOREIGN DATA WRAPPER foo VALIDATOR bar; -- ERROR
ERROR: function bar(text[], oid) does not exist ERROR: function bar(text[], oid) does not exist
ALTER FOREIGN DATA WRAPPER foo NO VALIDATOR; ALTER FOREIGN DATA WRAPPER foo NO VALIDATOR;
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+---------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | | foo | foreign_data_user | - | - | | |
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(3 rows) (3 rows)
ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2'); ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2');
@ -113,22 +113,22 @@ ALTER FOREIGN DATA WRAPPER foo OPTIONS (DROP c); -- ERROR
ERROR: option "c" not found ERROR: option "c" not found
ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD x '1', DROP x); ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD x '1', DROP x);
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+-----------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | {a=1,b=2} | foo | foreign_data_user | - | - | | {a=1,b=2} |
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(3 rows) (3 rows)
ALTER FOREIGN DATA WRAPPER foo OPTIONS (DROP a, SET b '3', ADD c '4'); ALTER FOREIGN DATA WRAPPER foo OPTIONS (DROP a, SET b '3', ADD c '4');
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+-----------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | {b=3,c=4} | foo | foreign_data_user | - | - | | {b=3,c=4} |
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(3 rows) (3 rows)
ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '2'); ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '2');
@ -136,7 +136,7 @@ ALTER FOREIGN DATA WRAPPER foo OPTIONS (b '4'); -- ERROR
ERROR: option "b" provided more than once ERROR: option "b" provided more than once
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+---------------+------------- ------------+-------------------+---------+--------------------------+-------------------+---------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | {b=3,c=4,a=2} | foo | foreign_data_user | - | - | | {b=3,c=4,a=2} |
@ -151,7 +151,7 @@ SET ROLE regress_test_role_super;
ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD d '5'); ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD d '5');
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+-------------------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | {b=3,c=4,a=2,d=5} | foo | foreign_data_user | - | - | | {b=3,c=4,a=2,d=5} |
@ -170,7 +170,7 @@ HINT: Must be superuser to alter a foreign-data wrapper.
RESET ROLE; RESET ROLE;
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------------+---------+--------------------------+-------------------+-------------------+------------- ------------+-------------------------+---------+--------------------------+-------------------+-------------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | regress_test_role_super | - | - | | {b=3,c=4,a=2,d=5} | foo | regress_test_role_super | - | - | | {b=3,c=4,a=2,d=5} |
@ -184,7 +184,7 @@ DROP FOREIGN DATA WRAPPER IF EXISTS nonexistent;
NOTICE: foreign-data wrapper "nonexistent" does not exist, skipping NOTICE: foreign-data wrapper "nonexistent" does not exist, skipping
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------------+---------+--------------------------+-------------------+-------------------+------------- ------------+-------------------------+---------+--------------------------+-------------------+-------------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | regress_test_role_super | - | - | | {b=3,c=4,a=2,d=5} | foo | regress_test_role_super | - | - | | {b=3,c=4,a=2,d=5} |
@ -203,11 +203,11 @@ ALTER ROLE regress_test_role_super SUPERUSER;
DROP FOREIGN DATA WRAPPER foo; DROP FOREIGN DATA WRAPPER foo;
DROP ROLE regress_test_role_super; DROP ROLE regress_test_role_super;
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+---------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(2 rows) (2 rows)
CREATE FOREIGN DATA WRAPPER foo; CREATE FOREIGN DATA WRAPPER foo;
@ -215,25 +215,25 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER foo;
COMMENT ON SERVER s1 IS 'foreign server'; COMMENT ON SERVER s1 IS 'foreign server';
CREATE USER MAPPING FOR current_user SERVER s1; CREATE USER MAPPING FOR current_user SERVER s1;
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+---------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
foo | foreign_data_user | - | - | | | foo | foreign_data_user | - | - | | |
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(3 rows) (3 rows)
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-------------------+----------------------+-------------------+------+---------+---------+---------------- ------+-------------------+----------------------+-------------------+------+---------+-------------+----------------
s1 | foreign_data_user | foo | | | | | foreign server s1 | foreign_data_user | foo | | | | | foreign server
(1 row) (1 row)
\deu+ \deu+
List of user mappings List of user mappings
Server | User name | Options Server | User name | FDW Options
--------+-------------------+--------- --------+-------------------+-------------
s1 | foreign_data_user | s1 | foreign_data_user |
(1 row) (1 row)
@ -252,23 +252,23 @@ NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to server s1 DETAIL: drop cascades to server s1
drop cascades to user mapping for foreign_data_user drop cascades to user mapping for foreign_data_user
\dew+ \dew+
List of foreign-data wrappers List of foreign-data wrappers
Name | Owner | Handler | Validator | Access privileges | Options | Description Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
------------+-------------------+---------+--------------------------+-------------------+---------+------------- ------------+-------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | foreign_data_user | - | - | | | useless dummy | foreign_data_user | - | - | | | useless
postgresql | foreign_data_user | - | postgresql_fdw_validator | | | postgresql | foreign_data_user | - | postgresql_fdw_validator | | |
(2 rows) (2 rows)
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-------+----------------------+-------------------+------+---------+---------+------------- ------+-------+----------------------+-------------------+------+---------+-------------+-------------
(0 rows) (0 rows)
\deu+ \deu+
List of user mappings List of user mappings
Server | User name | Options Server | User name | FDW Options
--------+-----------+--------- --------+-----------+-------------
(0 rows) (0 rows)
-- exercise CREATE SERVER -- exercise CREATE SERVER
@ -290,7 +290,7 @@ HINT: Valid options in this context are: authtype, service, connect_timeout, db
CREATE SERVER s8 FOREIGN DATA WRAPPER postgresql OPTIONS (host 'localhost', dbname 's8db'); CREATE SERVER s8 FOREIGN DATA WRAPPER postgresql OPTIONS (host 'localhost', dbname 's8db');
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-------------------+----------------------+-------------------+--------+---------+------------------------------+------------- ------+-------------------+----------------------+-------------------+--------+---------+------------------------------+-------------
s1 | foreign_data_user | foo | | | | | s1 | foreign_data_user | foo | | | | |
s2 | foreign_data_user | foo | | | | {host=a,dbname=b} | s2 | foreign_data_user | foo | | | | {host=a,dbname=b} |
@ -312,7 +312,7 @@ CREATE SERVER t1 FOREIGN DATA WRAPPER foo;
RESET ROLE; RESET ROLE;
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-------------------+----------------------+-------------------+--------+---------+------------------------------+------------- ------+-------------------+----------------------+-------------------+--------+---------+------------------------------+-------------
s1 | foreign_data_user | foo | | | | | s1 | foreign_data_user | foo | | | | |
s2 | foreign_data_user | foo | | | | {host=a,dbname=b} | s2 | foreign_data_user | foo | | | | {host=a,dbname=b} |
@ -336,7 +336,7 @@ SET ROLE regress_test_role;
CREATE SERVER t2 FOREIGN DATA WRAPPER foo; CREATE SERVER t2 FOREIGN DATA WRAPPER foo;
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-------------------+----------------------+-------------------+--------+---------+------------------------------+------------- ------+-------------------+----------------------+-------------------+--------+---------+------------------------------+-------------
s1 | foreign_data_user | foo | | | | | s1 | foreign_data_user | foo | | | | |
s2 | foreign_data_user | foo | | | | {host=a,dbname=b} | s2 | foreign_data_user | foo | | | | {host=a,dbname=b} |
@ -366,7 +366,7 @@ GRANT USAGE ON FOREIGN SERVER s1 TO regress_test_role;
GRANT USAGE ON FOREIGN SERVER s6 TO regress_test_role2 WITH GRANT OPTION; GRANT USAGE ON FOREIGN SERVER s6 TO regress_test_role2 WITH GRANT OPTION;
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-------------------+----------------------+-----------------------------------------+--------+---------+------------------------------+------------- ------+-------------------+----------------------+-----------------------------------------+--------+---------+------------------------------+-------------
s1 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user +| | 1.0 | {servername=s1} | s1 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user +| | 1.0 | {servername=s1} |
| | | regress_test_role=U/foreign_data_user | | | | | | | regress_test_role=U/foreign_data_user | | | |
@ -417,7 +417,7 @@ DETAIL: owner of server s1
privileges for foreign-data wrapper foo privileges for foreign-data wrapper foo
\des+ \des+
List of foreign servers List of foreign servers
Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options | Description Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
------+-----------------------+----------------------+-----------------------------------------+--------+---------+---------------------------------+------------- ------+-----------------------+----------------------+-----------------------------------------+--------+---------+---------------------------------+-------------
s1 | regress_test_indirect | foo | foreign_data_user=U/foreign_data_user +| | 1.1 | {servername=s1} | s1 | regress_test_indirect | foo | foreign_data_user=U/foreign_data_user +| | 1.1 | {servername=s1} |
| | | regress_test_role=U/foreign_data_user | | | | | | | regress_test_role=U/foreign_data_user | | | |
@ -585,7 +585,7 @@ ALTER USER MAPPING FOR public SERVER t1 OPTIONS (ADD modified '1');
RESET ROLE; RESET ROLE;
\deu+ \deu+
List of user mappings List of user mappings
Server | User name | Options Server | User name | FDW Options
--------+-------------------+----------------------------- --------+-------------------+-----------------------------
s4 | foreign_data_user | s4 | foreign_data_user |
s4 | public | {"mapping=is public"} s4 | public | {"mapping=is public"}
@ -654,17 +654,18 @@ COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
COMMENT ON COLUMN ft1.c1 IS 'ft1.c1'; COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
\d+ ft1 \d+ ft1
Foreign table "public.ft1" Foreign table "public.ft1"
Column | Type | Modifiers | Options | Storage | Description Column | Type | Modifiers | FDW Options | Storage | Description
--------+---------+-----------+---------------------------+----------+------------- --------+---------+-----------+---------------------------+----------+-------------
c1 | integer | not null | {param1=val1} | plain | ft1.c1 c1 | integer | not null | {param1=val1} | plain | ft1.c1
c2 | text | | {param2=val2,param3=val3} | extended | c2 | text | | {param2=val2,param3=val3} | extended |
c3 | date | | | plain | c3 | date | | | plain |
Server: sc Server: sc
FDW Options: {"delimiter=,","quote=\""}
Has OIDs: no Has OIDs: no
\det+ \det+
List of foreign tables List of foreign tables
Schema | Table | Server | Options | Description Schema | Table | Server | FDW Options | Description
--------+-------+--------+----------------------------+------------- --------+-------+--------+----------------------------+-------------
public | ft1 | sc | {"delimiter=,","quote=\""} | ft1 public | ft1 | sc | {"delimiter=,","quote=\""} | ft1
(1 row) (1 row)
@ -705,7 +706,7 @@ ALTER FOREIGN TABLE ft1 ALTER COLUMN c7 OPTIONS (ADD p1 'v1', ADD p2 'v2'),
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1); ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1);
\d+ ft1 \d+ ft1
Foreign table "public.ft1" Foreign table "public.ft1"
Column | Type | Modifiers | Options | Storage | Description Column | Type | Modifiers | FDW Options | Storage | Description
--------+---------+-----------+---------------------------+----------+------------- --------+---------+-----------+---------------------------+----------+-------------
c1 | integer | not null | {param1=val1} | plain | c1 | integer | not null | {param1=val1} | plain |
c2 | text | | {param2=val2,param3=val3} | extended | c2 | text | | {param2=val2,param3=val3} | extended |
@ -717,6 +718,7 @@ ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1);
c9 | integer | | | plain | c9 | integer | | | plain |
c10 | integer | | {p1=v1} | plain | c10 | integer | | {p1=v1} | plain |
Server: sc Server: sc
FDW Options: {"delimiter=,","quote=\""}
Has OIDs: no Has OIDs: no
-- can't change the column type if it's used elsewhere -- can't change the column type if it's used elsewhere
@ -748,7 +750,7 @@ ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1;
ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1; ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1;
\d foreign_schema.foreign_table_1 \d foreign_schema.foreign_table_1
Foreign table "foreign_schema.foreign_table_1" Foreign table "foreign_schema.foreign_table_1"
Column | Type | Modifiers | Options Column | Type | Modifiers | FDW Options
------------------+---------+-----------+--------------------------- ------------------+---------+-----------+---------------------------
foreign_column_1 | integer | not null | {param1=val1} foreign_column_1 | integer | not null | {param1=val1}
c2 | text | | {param2=val2,param3=val3} c2 | text | | {param2=val2,param3=val3}
@ -759,6 +761,7 @@ ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1;
c8 | text | | {p2=V2} c8 | text | | {p2=V2}
c10 | integer | | {p1=v1} c10 | integer | | {p1=v1}
Server: sc Server: sc
FDW Options: {quote=~,escape=@}
-- Information schema -- Information schema
SELECT * FROM information_schema.foreign_data_wrappers ORDER BY 1, 2; SELECT * FROM information_schema.foreign_data_wrappers ORDER BY 1, 2;