提交 d82d8486 编写于 作者: R Robert Haas

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
上级 5057366e
......@@ -892,15 +892,14 @@ testdb=>
<para>
For some types of relation, <literal>\d</> shows additional information
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>
The command form <literal>\d+</literal> is identical, except that
more information is displayed: any comments associated with 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
options if the relation is a foreign table.
table, the view definition if the relation is a view.
</para>
<para>
......
......@@ -1367,7 +1367,7 @@ describeOneTableDetails(const char *schemaname,
headers[cols++] = gettext_noop("Definition");
if (tableinfo.relkind == 'f' && pset.sversion >= 90200)
headers[cols++] = gettext_noop("Options");
headers[cols++] = gettext_noop("FDW Options");
if (verbose)
{
......@@ -2033,9 +2033,12 @@ describeOneTableDetails(const char *schemaname,
/* print foreign server name */
if (tableinfo.relkind == 'f')
{
char *ftoptions;
/* Footer information about foreign table */
printfPQExpBuffer(&buf,
"SELECT s.srvname\n"
"SELECT s.srvname,\n"
" f.ftoptions\n"
"FROM pg_catalog.pg_foreign_table f,\n"
" pg_catalog.pg_foreign_server s\n"
"WHERE f.ftrelid = %s AND s.oid = f.ftserver;",
......@@ -2049,9 +2052,18 @@ describeOneTableDetails(const char *schemaname,
goto error_return;
}
/* Print server name */
printfPQExpBuffer(&buf, "Server: %s",
PQgetvalue(result, 0, 0));
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);
}
......@@ -3668,7 +3680,7 @@ listForeignDataWrappers(const char *pattern, bool verbose)
printACLColumn(&buf, "fdwacl");
appendPQExpBuffer(&buf,
",\n fdwoptions AS \"%s\"",
gettext_noop("Options"));
gettext_noop("FDW Options"));
if (pset.sversion >= 90100)
appendPQExpBuffer(&buf,
......@@ -3744,7 +3756,7 @@ listForeignServers(const char *pattern, bool verbose)
" d.description AS \"%s\"",
gettext_noop("Type"),
gettext_noop("Version"),
gettext_noop("Options"),
gettext_noop("FDW Options"),
gettext_noop("Description"));
}
......@@ -3807,7 +3819,7 @@ listUserMappings(const char *pattern, bool verbose)
if (verbose)
appendPQExpBuffer(&buf,
",\n um.umoptions AS \"%s\"",
gettext_noop("Options"));
gettext_noop("FDW Options"));
appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_user_mappings um\n");
......@@ -3863,7 +3875,7 @@ listForeignTables(const char *pattern, bool verbose)
appendPQExpBuffer(&buf,
",\n ft.ftoptions AS \"%s\",\n"
" d.description AS \"%s\"",
gettext_noop("Options"),
gettext_noop("FDW Options"),
gettext_noop("Description"));
appendPQExpBuffer(&buf,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册