INSERT ... RETURNING as Oracle

From: "Sipos Andras" <s-andras(at)freemail(dot)hu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: INSERT ... RETURNING as Oracle
Date: 2001-03-03 18:55:27
Message-ID: 005101c0a413$83815900$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
);

Can I how to make in one step insert into the table and get values of 'ID' ?
I find similar solution then oracle's INSERT ... RETURNING.

If first make INSERT, and after SELECT MAX(ID), then result is uncertain.

my system version: 7.0.2

Thx,
Andras

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-03 18:56:00 Re: Why is explain horribly optimistic for sorts?
Previous Message Ben 2001-03-03 18:27:55 Re: Why is explain horribly optimistic for sorts?