@@ -1609,6 +1609,43 @@ describeOneTableDetails(const char *schemaname,
16091609PQclear (result );
16101610}
16111611}
1612+ else if (tableinfo .relkind == 'S' )
1613+ {
1614+ /* Footer information about a sequence */
1615+ PGresult * result = NULL ;
1616+
1617+ /* Get the column that owns this sequence */
1618+ printfPQExpBuffer (& buf ,"SELECT pg_catalog.quote_ident(nspname) || '.' ||"
1619+ "\n pg_catalog.quote_ident(relname) || '.' ||"
1620+ "\n pg_catalog.quote_ident(attname)"
1621+ "\nFROM pg_catalog.pg_class c"
1622+ "\nINNER JOIN pg_catalog.pg_depend d ON c.oid=d.refobjid"
1623+ "\nINNER JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace"
1624+ "\nINNER JOIN pg_catalog.pg_attribute a ON ("
1625+ "\n a.attrelid=c.oid AND"
1626+ "\n a.attnum=d.refobjsubid)"
1627+ "\nWHERE d.classid='pg_catalog.pg_class'::pg_catalog.regclass"
1628+ "\n AND d.refclassid='pg_catalog.pg_class'::pg_catalog.regclass"
1629+ "\n AND d.objid=%s"
1630+ "\n AND d.deptype='a'" ,
1631+ oid );
1632+
1633+ result = PSQLexec (buf .data , false);
1634+ if (!result )
1635+ gotoerror_return ;
1636+ else if (PQntuples (result )== 1 )
1637+ {
1638+ printfPQExpBuffer (& buf ,_ ("Owned by: %s" ),
1639+ PQgetvalue (result ,0 ,0 ));
1640+ printTableAddFooter (& cont ,buf .data );
1641+ }
1642+ /*
1643+ * If we get no rows back, don't show anything (obviously).
1644+ * We should never get more than one row back, but if we do,
1645+ * just ignore it and don't print anything.
1646+ */
1647+ PQclear (result );
1648+ }
16121649else if (tableinfo .relkind == 'r' || tableinfo .relkind == 'f' )
16131650{
16141651/* Footer information about a table */