automatic sequence number?

From: apnv3(at)muha(dot)net
To: pgsql-jdbc(at)postgresql(dot)org
Subject: automatic sequence number?
Date: 2003-11-02 14:28:59
Message-ID: 20031102142859.GA29500@muha.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello.

I have a table with one field acting as primary key, the key is
retrieved from a sequence-generator in postgresql.
Currently I am executing two queries for every insert;

Query #1 retrieves a number from a sequence-generator, and places it into the
record.

Query #2 performs the actual insert.

Does anyone have an idea how to cut this down to only one query?
And maybe somehow get back the primary key in the ResultSet.

Or maybe this is how it is supposed to be done, it is just that I am not
very experienced in jdbc/sql to know. :)

Thanks in advance.

//ap

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rod Taylor 2003-11-02 15:06:38 Re: automatic sequence number?
Previous Message Christer Sundgren 2003-11-02 07:50:54 pg73jbdc3 performace