PQclear(result);
}
+ if (tableinfo.relkind == RELKIND_TOASTVALUE)
+ {
+ /* For a TOAST table, print name of owning table */
+ PGresult *result;
+
+ printfPQExpBuffer(&buf,
+ "SELECT n.nspname, c.relname\n"
+ "FROM pg_catalog.pg_class c"
+ " JOIN pg_catalog.pg_namespace n"
+ " ON n.oid = c.relnamespace\n"
+ "WHERE reltoastrelid = '%s';", oid);
+ result = PSQLexec(buf.data);
+ if (!result)
+ goto error_return;
+
+ if (PQntuples(result) == 1)
+ {
+ char *schemaname = PQgetvalue(result, 0, 0);
+ char *relname = PQgetvalue(result, 0, 1);
+
+ printfPQExpBuffer(&tmpbuf, _("Owning table: \"%s.%s\""),
+ schemaname, relname);
+ printTableAddFooter(&cont, tmpbuf.data);
+ }
+ PQclear(result);
+ }
+
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
PQclear(result);
}
+ /* If you add relkinds here, see also "Finish printing..." stanza below */
else if (tableinfo.relkind == RELKIND_RELATION ||
tableinfo.relkind == RELKIND_MATVIEW ||
tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
- tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
+ tableinfo.relkind == RELKIND_PARTITIONED_TABLE ||
+ tableinfo.relkind == RELKIND_TOASTVALUE)
{
/* Footer information about a table */
PGresult *result = NULL;
if (tableinfo.relkind == RELKIND_RELATION ||
tableinfo.relkind == RELKIND_MATVIEW ||
tableinfo.relkind == RELKIND_FOREIGN_TABLE ||
- tableinfo.relkind == RELKIND_PARTITIONED_TABLE)
+ tableinfo.relkind == RELKIND_PARTITIONED_TABLE ||
+ tableinfo.relkind == RELKIND_TOASTVALUE)
{
PGresult *result;
int tuples;
relkind == RELKIND_MATVIEW ||
relkind == RELKIND_INDEX ||
relkind == RELKIND_PARTITIONED_TABLE ||
- relkind == RELKIND_PARTITIONED_INDEX)
+ relkind == RELKIND_PARTITIONED_INDEX ||
+ relkind == RELKIND_TOASTVALUE)
{
/*
* We ignore the database default tablespace so that users not using
set search_path to default;
set role to default;
drop role regress_partitioning_role;
+-- \d on toast table (use pg_statistic's toast table, which has a known name)
+\d pg_toast.pg_toast_2619
+TOAST table "pg_toast.pg_toast_2619"
+ Column | Type
+------------+---------
+ chunk_id | oid
+ chunk_seq | integer
+ chunk_data | bytea
+Owning table: "pg_catalog.pg_statistic"
+Indexes:
+ "pg_toast_2619_index" PRIMARY KEY, btree (chunk_id, chunk_seq)
+