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

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group