Return the primary key of a newly inserted row?

From: John Tregea <john(at)debraneys(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Return the primary key of a newly inserted row?
Date: 2006-06-22 03:39:12
Message-ID: 449A10E0.6060200@debraneys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greeting again,

I am writing records to postgreSQL from an IDE called revolution. At the
time I perform the INSERT command I need to retrieve the value of the
serial_id column from the newly created row.

Is it possible to have a specified column value returned after the
INSERT (rather than the number of rows affected) ?

That would save me doing a SELECT select statement after every INSERT.

Please excuse the terminology if it is not SQL'esque, but I hope you
know what I am getting at.

Thanks in advance

John Tregea

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Tregea 2006-06-22 03:44:31 Re: Return the primary key of a newly inserted row?
Previous Message Qingqing Zhou 2006-06-22 03:01:14 Re: Out of memory error in 8.1.0 Win32