Carlo Stonebanks <carlo@xxxxxxxxxxxxx> writes: > Thanks Adrian and Jerry. > > Technically, the best way to know which sequence a column is dependent on is > to actually query for it. I have functions which query > information_schema.columns and run a regex_replace to extract the sequence > name from the defaulting nextval() expression. This is better than demanding > that sequence names are predictable, but I wonder if there isn't a better > query to run that doesn't require parsing texts? Obviously PG knows about > the sequence's relation, probably via a dependency that finds it by > rendering the text to regclass to an OID... but this stuff makes me nervous. Nervous or otherwise, if your sequences are owned by the tables either by their implicit creation with SERIAL keyword or a later ALTER SEQUENCE OWNED BY, then querying the class and depend catalogues is your most reliable bet. -- Jerry Sievers Postgres DBA/Development Consulting e: gsievers19@xxxxxxxxxxx p: 305.321.1144 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general