From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | "Kian Spongsveen (spam account)" <spam(at)kian(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Question (or feature request) on serial datatype |
Date: | 2003-07-23 15:28:39 |
Message-ID: | 20030723152839.GA21046@wolff.to |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jul 22, 2003 at 12:24:00 +0200,
"Kian Spongsveen (spam account)" <spam(at)kian(dot)org> wrote:
> could directly call currval *after* inserting. Doing a manual nextval()
> before the insert is OK, too, but from my understanding it needs the sequence
> name and not the column name?
Yes, nextval expects the name of the sequence passed as a string.
> When the RDBMS is decided, you want to hide the annoyances of each platform
> as much as possible. Having to know at a later phase that a certain sequence
> name has been associated with the serial column is unneccessary for the
> front-end developers. I can't find any simple way of programatically finding
> the sequence name either. I believe this is much simpler in Sybase ASE/ASA,
> Microsoft Access/SQL Server and MySQL so PostgreSQL should improve the
> functionality too?
The sequence names are picked using a pattern that you could just use
if you avoid a few things in your naming convention. Or alternatively
you could manually create the sequences using your own rules for namming.
Unless there is a conflict or the name is too long a sequence for a serial
column is named tablename_columnname_seq .
From | Date | Subject | |
---|---|---|---|
Next Message | Shridhar Daithankar | 2003-07-23 15:30:41 | Re: 7.4dev or beta version |
Previous Message | Peter Eisentraut | 2003-07-23 15:17:09 | Re: 0/1 vs true/false |