Re: INSERT ... RETURNING as Oracle

From: "Martin A(dot) Marques" <martin(at)math(dot)unl(dot)edu(dot)ar>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT ... RETURNING as Oracle
Date: 2001-03-05 13:25:59
Message-ID: Pine.LNX.4.10.10103051021150.1796-100000@math.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)math(dot)unl(dot)edu(dot)ar
Santa Fe - Argentina http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anthony E . Greene 2001-03-05 13:47:07 Re: postmaster confiugration and hardware configuration
Previous Message Juan Ramón Cortabitarte 2001-03-05 12:17:18 RE: [PHP] How to connect to PostgreSQL with phpPgAdmi