Re: nextval, sequences and sequencenames

From: wsheldah(at)lexmark(dot)com
To: Gordan Bobic <gordan(at)bobich(dot)net>
Cc: Wieger Uffink <wieger(at)usmedia(dot)nl>, PostgreSQL-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: nextval, sequences and sequencenames
Date: 2001-08-20 19:37:21
Message-ID: 200108201937.PAA02227@interlock2.lexmark.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I think someone pointed out not long ago that that naming convention isn't
always 100% reliable. How about creating the sequence dynamically (using that
naming convention even), then create the table dynamically and have it
explicitly use the sequence you just created. That way you *know* the name of
the sequence; should probably check to be sure the name isn't already in use, or
trap for errors when creating the sequence and adjust accordingly.

Gordan Bobic <gordan%bobich(dot)net(at)interlock(dot)lexmark(dot)com> on 08/15/2001 04:14:02 AM

To: Wieger Uffink <wieger%usmedia(dot)nl(at)interlock(dot)lexmark(dot)com>
cc: PostgreSQL-General <pgsql-general%postgresql(dot)org(at)interlock(dot)lexmark(dot)com>
(bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] nextval, sequences and sequencenames

On Tue, 14 Aug 2001, Wieger Uffink wrote:

> My question:
> is there anyway of retreiving the sequence_name corresponding to the
> respective column,
> knowing just the tablename and columnname?
>
> The reason I need to do this, is because the application I write
> dynamicly creates new tables, and I have no way of knowing the sequence
> name before hand.
>

Try "tablename_fieldname_seq". That is the default sequence name for a
"serial" field.

Cheers.

Gordan

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Browse pgsql-general by date

  From Date Subject
Next Message Ryan C. Bonham 2001-08-20 20:02:55 RE: [ODBC] Re: Updating a view
Previous Message Erwin Lansing 2001-08-20 19:23:02 Re: Perfomance decreasing