INSERT ... RETURNING as Oracle - Mailing list pgsql-general

From Sipos Andras
Subject INSERT ... RETURNING as Oracle
Date
Msg-id 004801c0a4df$d3e77ec0$0401a8c0@mzperx.hu
Whole thread Raw
Responses Re: INSERT ... RETURNING as Oracle
Re: INSERT ... RETURNING as Oracle
List 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@freemail.hu



pgsql-general by date:

Previous
From: will trillich
Date:
Subject: Re: can a trigger on insert -> update other tables?
Next
From: Peter Eisentraut
Date:
Subject: Re: INSERT ... RETURNING as Oracle