Return key from query

From: Jonathan Tripathy <jonnyt(at)abpni(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Return key from query
Date: 2010-11-02 20:43:48
Message-ID: 4CD07804.2010901@abpni.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi everyone,

When adding a new record, we run an insert query which auto-increments
the primary key for the table. However the method (in java) which calls
this query must return the newly created key.

Any ideas on how to do this, preferably using a single transaction?

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2010-11-02 20:52:20 Re: Return key from query
Previous Message Tom Lane 2010-11-02 19:23:37 Re: pg_upgrade segfault (was: pg_migrator segfault)