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 <[EMAIL PROTECTED]> on 08/15/2001 04:14:02 AM
To: Wieger Uffink <[EMAIL PROTECTED]>
cc: PostgreSQL-General <[EMAIL PROTECTED]>
(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
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl