derive the sequence name of a column

From: "Mel Jamero" <mel(at)gmanmi(dot)tv>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: derive the sequence name of a column
Date: 2003-10-24 07:41:00
Message-ID: 000001c39a02$2b8674f0$1b06a8c0@cmpmel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi!

Can anyone please tell me exactly how the name of a sequence a field is
using (manually created or generated by a serial) could be derived
programmatically (using libpq or through SQL)?

Thus:

CREATE SEQUENCE an_unknown_sequence_name;
CREATE TABLE test (
test_id integer default nextval('an_unknown_sequence_name'),
useless_redundant_test_id serial
);

How do I programmatically extract that column 'test_id' in table 'test'
is using 'an_unknown_sequence_name'

TIA!

Mel

In response to

  • Re: libpq at 2003-10-23 19:51:22 from Bruno LEVEQUE

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Eric S. Johansson 2003-10-24 18:25:48 Re: Getting up and running on Red Hat 9
Previous Message Bruno LEVEQUE 2003-10-23 19:51:22 Re: libpq