Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: sequences and dependences



>   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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group