Re: [GENERAL] Return key from query

2010-11-03 Thread Igor Neyman
> -Original Message- > From: Jonathan Tripathy [mailto:jon...@abpni.co.uk] > Sent: Wednesday, November 03, 2010 12:46 PM > To: Rob Sargent; pgsql-general@postgresql.org > Subject: Re: Return key from query > > > >> > >> Sorry, I don't get it. I usually have an application that > know

Re: [GENERAL] Return key from query

2010-11-03 Thread Szymon Guz
On 3 November 2010 17:46, Jonathan Tripathy wrote: > > >>> Sorry, I don't get it. I usually have an application that knows if it >>> wants to write some data to database, or not. So it writes the data, and >>> just gets from database the id that was set by database. No need of >>> getting the id

Re: [GENERAL] Return key from query

2010-11-03 Thread Jonathan Tripathy
Sorry, I don't get it. I usually have an application that knows if it wants to write some data to database, or not. So it writes the data, and just gets from database the id that was set by database. No need of getting the id earlier in a transaction, although the simple insert that saves the d

Re: [GENERAL] Return key from query

2010-11-03 Thread Rob Sargent
On 11/03/2010 02:08 AM, Szymon Guz wrote: > > > On 3 November 2010 00:41, Rob Sargent > wrote: > > > > On 11/02/2010 03:03 PM, Szymon Guz wrote: > > > > > > On 2 November 2010 21:59, Rob Sargent > >

Re: [GENERAL] Return key from query

2010-11-02 Thread Szymon Guz
On 2 November 2010 21:59, Rob Sargent wrote: > > > On 11/02/2010 02:43 PM, Jonathan Tripathy wrote: > > 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 retur

Re: [GENERAL] Return key from query

2010-11-02 Thread Rob Sargent
On 11/02/2010 02:43 PM, Jonathan Tripathy wrote: > 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, p

Re: [GENERAL] Return key from query

2010-11-02 Thread Szymon Guz
On 2 November 2010 21:43, Jonathan Tripathy wrote: > 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, p

Re: [GENERAL] Return key from query

2010-11-02 Thread Steve Crawford
On 11/02/2010 01:43 PM, Jonathan Tripathy wrote: 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 u

[GENERAL] Return key from query

2010-11-02 Thread Jonathan Tripathy
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 -- Sent via pg