Re: Design question regarding arrays

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
Cc: "Oliver Fromme" <olli(at)lurza(dot)secnetix(dot)de>, "A Gilmore" <agilmore(at)shaw(dot)ca>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Design question regarding arrays
Date: 2004-08-09 10:26:27
Message-ID: 925EA687-E9EE-11D8-B87D-000A95C88220@myrealbox.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Fromme 2004-08-09 10:29:27 Re: Design question regarding arrays
Previous Message Michael Glaesemann 2004-08-09 10:16:29 Re: Design question regarding arrays