From: | "Dave Cramer" <Dave(at)micro-automation(dot)net> |
---|---|
To: | "'G(dot)L(dot) Grobe'" <gary(at)grobe(dot)net>, <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: unique id's and incr |
Date: | 2001-07-24 01:10:52 |
Message-ID: | 00bb01c113dd$7c456f70$8201a8c0@inspiron |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Gary,
The most generic way to do this is to create a sequence, and then select
next('sequencename') and use that to insert into the row
Dave
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of G.L. Grobe
Sent: July 23, 2001 8:00 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] unique id's and incr
During the creation of my database, I'm doing a:
CREATE UNIQUE INDEX account_idx ON Accounts (account_id);
to add new rows to my table and keep the id's unique.
During runtime (accessing by JDBC), is there anyway when adding a new
row to a table to know the last id entry so as to incr the next one for
a new id. I was thinking there might be a way to do this w/o having to
query the table for the last id and incr the id before I do another
insert.
Any help much appreciated.
From | Date | Subject | |
---|---|---|---|
Next Message | Eric G. Miller | 2001-07-24 03:55:42 | Re: Posting Again... Please Help |
Previous Message | Dominic J. Eidson | 2001-07-24 00:47:17 | Re: Referential cascade technique |