| From: | Ioannis Tambouras <ioannis(at)akroninc(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Cc: | team(at)viable(dot)net |
| Subject: | Re: sequences and dependences |
| Date: | 2008-05-24 15:06:40 |
| Message-ID: | 20080524150640.GA24460@akroninc.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Smith | 2008-05-24 15:08:54 | Re: sequences and dependences |
| Previous Message | john | 2008-05-24 15:03:31 | editing functions/triggers etc.. |