From: Jim C. Nasby <jnasby@pervasive.com>
To: Thusitha Kodikara <kthusi@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Relationship beween sequences (serial) and tables
Date: Fri, 9 Sep 2005 12:28:01 -0500
Message-ID: <20050909172801.GG7630@pervasive.com> (raw)
In-Reply-To: <20050908080327.94284.qmail@web34405.mail.mud.yahoo.com>
References: <20050908080327.94284.qmail@web34405.mail.mud.yahoo.com>
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@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: jnasby@pervasive.com, kthusi@yahoo.com
Subject: Re: Relationship beween sequences (serial) and tables
In-Reply-To: <20050909172801.GG7630@pervasive.com>
References: <20050908080327.94284.qmail@web34405.mail.mud.yahoo.com> <20050909172801.GG7630@pervasive.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox