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

From Martin A. Marques
Subject Re: INSERT ... RETURNING as Oracle
Date
Msg-id Pine.LNX.4.10.10103051021150.1796-100000@math.unl.edu.ar
Whole thread Raw
In response to Re: INSERT ... RETURNING as Oracle  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Re: INSERT ... RETURNING as Oracle  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Sun, 4 Mar 2001, Peter Eisentraut wrote:

> > If I use at first the INSERT, and after SELECT MAX(ID), the result will be
> > uncertain.
>
> If you are worried about other transactions getting in the way then you
> should do SET TRANSACTION ISOLATION LEVEL SERIABLIZABLE.

I have some uncertainty about somethings that I've read from the FAQ.

If I have a client INSERT a value in a table (all happens inside a BEGIN
WORK ---- COMMIT WORK), which has a SERIAL column, and I want to
reference that serial value on another INT column which is a foreign key
of that SERIAL. Using currval() function will give me exact value as the
FAQs say, and why? Is it the transaction that makes this work this way?

Saludos... :-)

System Administration: It's a dirty job,
but someone told I had to do it.
-----------------------------------------------------------------
Martín Marqués            email:     martin@math.unl.edu.ar
Santa Fe - Argentina        http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------


pgsql-general by date:

Previous
From: Juan Ramón Cortabitarte
Date:
Subject: RE: [PHP] How to connect to PostgreSQL with phpPgAdmi
Next
From: "Anthony E . Greene"
Date:
Subject: Re: postmaster confiugration and hardware configuration