Getting the column to a which a sequence belongs.

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Getting the column to a which a sequence belongs.
Date: 2009-08-27 19:18:57
Message-ID: h76m6t$ne7$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 if there 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 that have 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 looking for 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 catalogs documentation.

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

Regards
Thomas

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-27 19:32:15 Re: [SQL] Data audit trail techniques in postgresql
Previous Message Thomas Kellerer 2009-08-27 19:14:19 Re: Select data for current week only