appendPQExpBuffer(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
else
appendPQExpBuffer(&buf, ",\n NULL AS indexdef");
+ if (tableinfo.relkind == 'f' && pset.sversion >= 90200)
+ appendPQExpBuffer(&buf, ",\n a.attfdwoptions");
+ else
+ appendPQExpBuffer(&buf, ",\n NULL AS attfdwoptions");
if (verbose)
appendPQExpBuffer(&buf, ",\n a.attstorage, pg_catalog.col_description(a.attrelid, a.attnum)");
appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a");
if (tableinfo.relkind == 'i')
headers[cols++] = gettext_noop("Definition");
+ if (tableinfo.relkind == 'f' && pset.sversion >= 90200)
+ headers[cols++] = gettext_noop("Options");
+
if (verbose)
{
headers[cols++] = gettext_noop("Storage");
if (tableinfo.relkind == 'i')
printTableAddCell(&cont, PQgetvalue(res, i, 6), false, false);
+ /* FDW options for foreign table column, only for 9.2 or later */
+ if (tableinfo.relkind == 'f' && pset.sversion >= 90200)
+ printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false);
+
/* Storage and Description */
if (verbose)
{
- int firstvcol = 7;
+ int firstvcol = 8;
char *storage = PQgetvalue(res, i, firstvcol);
/* these strings are literal in our syntax, so not translated. */
COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
\d+ ft1
- Foreign table "public.ft1"
- Column | Type | Modifiers | Storage | Description
---------+---------+-----------+----------+-------------
- c1 | integer | not null | plain | ft1.c1
- c2 | text | | extended |
- c3 | date | | plain |
+ Foreign table "public.ft1"
+ Column | Type | Modifiers | Options | Storage | Description
+--------+---------+-----------+---------------------------+----------+-------------
+ c1 | integer | not null | {param1=val1} | plain | ft1.c1
+ c2 | text | | {param2=val2,param3=val3} | extended |
+ c3 | date | | | plain |
Server: sc
Has OIDs: no
ALTER COLUMN c8 OPTIONS (ADD p1 'v1', ADD p2 'v2');
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1);
\d+ ft1
- Foreign table "public.ft1"
- Column | Type | Modifiers | Storage | Description
---------+---------+-----------+----------+-------------
- c1 | integer | not null | plain |
- c2 | text | | extended |
- c3 | date | | plain |
- c4 | integer | | plain |
- c6 | integer | not null | plain |
- c7 | integer | | plain |
- c8 | text | | extended |
- c9 | integer | | plain |
- c10 | integer | | plain |
+ Foreign table "public.ft1"
+ Column | Type | Modifiers | Options | Storage | Description
+--------+---------+-----------+---------------------------+----------+-------------
+ c1 | integer | not null | {param1=val1} | plain |
+ c2 | text | | {param2=val2,param3=val3} | extended |
+ c3 | date | | | plain |
+ c4 | integer | | | plain |
+ c6 | integer | not null | | plain |
+ c7 | integer | | {p1=v1,p2=v2} | plain |
+ c8 | text | | {p2=V2} | extended |
+ c9 | integer | | | plain |
+ c10 | integer | | {p1=v1} | plain |
Server: sc
Has OIDs: no
ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1;
ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1;
\d foreign_schema.foreign_table_1
-Foreign table "foreign_schema.foreign_table_1"
- Column | Type | Modifiers
-------------------+---------+-----------
- foreign_column_1 | integer | not null
- c2 | text |
- c3 | date |
- c4 | integer |
- c6 | integer | not null
- c7 | integer |
- c8 | text |
- c10 | integer |
+ Foreign table "foreign_schema.foreign_table_1"
+ Column | Type | Modifiers | Options
+------------------+---------+-----------+---------------------------
+ foreign_column_1 | integer | not null | {param1=val1}
+ c2 | text | | {param2=val2,param3=val3}
+ c3 | date | |
+ c4 | integer | |
+ c6 | integer | not null |
+ c7 | integer | | {p1=v1,p2=v2}
+ c8 | text | | {p2=V2}
+ c10 | integer | | {p1=v1}
Server: sc
-- Information schema