Re: Design question regarding arrays - Mailing list pgsql-novice

From Michael Glaesemann
Subject Re: Design question regarding arrays
Date
Msg-id 925EA687-E9EE-11D8-B87D-000A95C88220@myrealbox.com
Whole thread Raw
In response to Re: Design question regarding arrays  ("Sean Davis" <sdavis2@mail.nih.gov>)
List pgsql-novice
On Aug 9, 2004, at 7:14 PM, Sean Davis wrote:

> I'm a novice, too, but why not look up the value in the sequence and
> increment it before doing any inserting?  If you are doing all the
> inserts
> at the same time (more or less), then you can just use this value in
> the
> insert into both tables.  Put all of this inside one transaction.

Actually, I don't even think it has to be inside a transaction. Beyond
being transaction safe, currval is session safe (correcting something I
said in an earlier post). As long as you don't put another insert or
otherwise manipulate the sequence in the same session, you can trust
currval

Michael Glaesemann
grzm myrealbox com


pgsql-novice by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Design question regarding arrays
Next
From: Oliver Fromme
Date:
Subject: Re: Design question regarding arrays