Getting the column to a which a sequence belongs. - Mailing list pgsql-general

From Thomas Kellerer
Subject Getting the column to a which a sequence belongs.
Date
Msg-id h76m6t$ne7$1@ger.gmane.org
Whole thread Raw
Responses Re: Getting the column to a which a sequence belongs.  (Sam Mason <sam@samason.me.uk>)
List pgsql-general
Hi,

I'm trying to extend the Postgres support in my SQL tool. I'm trying to recreate the SQL for a sequence, and I wonder
ifthere is a way to find out the column to which a sequence "belongs".  

I'm talking either about sequences that are created automatically by PG when using the serial datatype or sequences
thathave been changed using ALTER SEQUENCE ... OWNED BY ... 

I know I can get the sequence that belongs to a column using pg_get_serial_sequence() (although only in 8.4), but I'm
lookingfor the other way: given a sequence find out if it's "owned" by a column.  

So far "debugging" psql using the -E option didn't show up anything and I couldn't find any hints in the system
catalogsdocumentation. 

Is this possible at all? As neither psql nor pgAdmin display this information, I suspect it's not.

Regards
Thomas

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Select data for current week only
Next
From: Alvaro Herrera
Date:
Subject: Re: [SQL] Data audit trail techniques in postgresql