Postgres: To list sequences along with the tables they are tied to

 SELECT S.relname, T.relname AS table_name

FROM pg_class S
LEFT JOIN pg_depend D ON (S.oid = D.objid)
LEFT JOIN pg_class T ON (D.refobjid = T.oid)
LEFT JOIN pg_namespace N ON (N.oid = S.relnamespace)
WHERE S.relkind = 'S';

Comments

Popular posts from this blog

Oracle: To clean up WRI$_ADV_OBJECTS