unique id's and incr

From: "G(dot)L(dot) Grobe" <gary(at)grobe(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: unique id's and incr
Date: 2001-07-23 23:59:36
Message-ID: 003801c113d3$86c94890$0200a8c0@trinity
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Buttafuoco 2001-07-24 00:24:44 Re: Referential cascade technique
Previous Message Lee Harr 2001-07-23 23:53:33 Re: pqReadData() -- backend closed the channel unexpectedly.