Re: sequences and dependences - Mailing list pgsql-general

From Ioannis Tambouras
Subject Re: sequences and dependences
Date
Msg-id 20080524150640.GA24460@akroninc.net
Whole thread Raw
In response to sequences and dependences  (Laurent ROCHE <laurent_roche@yahoo.com>)
List pgsql-general
>   I would like to write a request where I would get the table name and
>   column name of a sequence.
>   In fact I want the opposite of pg_get_serial_sequence !


You are looking for refobjid in pg_depend, but this
time the sequence could be a dependent to more than table.

A query like the one bellow is should give you the name of the table,
assuming you account for the correct namespace; it will not automatically
show the name of the column:

select objid::regclass, refobjid::regclass
from pg_depend
where objid::regclass::text = 'person_id_seq' ;


Thanks
Ioannis Tambouras

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: XML2 module and xpath_table
Next
From: Greg Smith
Date:
Subject: Re: sequences and dependences