INSERT ... RETURNING as Oracle

From: "Sipos Andras" <s-andras-nospam4(at)freemail(dot)hu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: INSERT ... RETURNING as Oracle
Date: 2001-03-04 19:17:59
Message-ID: 004801c0a4df$d3e77ec0$0401a8c0@mzperx.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Sample table:

create table basket (
id serial NOT NULL PRIMARY KEY,
timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

How can I make a one step insert into the table and get values of 'ID' ?
I am trying to find a similar solution as in the oracle's INSERT ...
RETURNING.

If I use at first the INSERT, and after SELECT MAX(ID), the result will be
uncertain.

my system version: 7.0.2

Thx,
Andras s-andras(at)freemail(dot)hu

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-03-04 20:03:23 Re: INSERT ... RETURNING as Oracle
Previous Message will trillich 2001-03-04 19:07:56 Re: can a trigger on insert -> update other tables?