Re: Relationship beween sequences (serial) and tables

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Thusitha Kodikara <kthusi(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Relationship beween sequences (serial) and tables
Date: 2005-09-09 17:28:01
Message-ID: 20050909172801.GG7630@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Sep 08, 2005 at 01:03:26AM -0700, Thusitha Kodikara wrote:
> Hi,
>
> I use Postgres 7.4.5 on Linux
>
> In many of my tables the primary key is bigserial for which sequences are automatcially generated. Through pg_catalog tables how can I find the relationship petween each table and its corresponding sequence ?

If you install newsysviews (http://pgfoundry.org/projects/newsysviews/)
the following query will give you all table columns that are using a
sequence for their default value:

select * from pg_user_table_columns where default_value like 'nextval(%';
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jim C. Nasby 2005-09-09 17:55:43 Re: Disabling WAL for bulk data loads
Previous Message Chris Browne 2005-09-09 17:14:28 Re: Disabling WAL for bulk data loads