Hi
Apologies in advance, I'm a *very* new PostgreSQL user so if this is obvious to you, it's not to me...
I can't seem to work out how I query in the system catalog tables to find a sequence related to a table's column.
For example, if I
CREATE TABLE tab1(col1 SERIAL)
pg_dump then shows:
CREATE TABLE tab1(
col1 INTEGER
);
[...]
CREATE SEQUENCE tab1_col1_seq
START WITH ! [...] etc
[...]
ALTER SEQUENCE tab1_col1_seq OWNED BYtab1.col1;
So this shows it's worked.
What query can I run against the system catalog to show that tab2_col1_seq is owned by tab2.col1? The OID for pg_class.relname 'tab1' and the OID for pg_class.relname 'tab1_col1_seq' are different (obviously) but I can't find anything in pg_attribute, pg_type and so on that I can use to make a logical connection between them...
(This is related to converting a 500-table Informix database with SERIALs to PostgreSQL and our programs subsequently needing to be able to identify the SERIAL columns for a given table by querying the system catalog).
Thanks
Malc