Re: Design question regarding arrays

From: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
To: sdavis2(at)mail(dot)nih(dot)gov (Sean Davis)
Cc: grzm(at)myrealbox(dot)com (Michael Glaesemann), pgsql-novice(at)postgresql(dot)org, agilmore(at)shaw(dot)ca (A Gilmore)
Subject: Re: Design question regarding arrays
Date: 2004-08-09 10:29:27
Message-ID: 200408091029.i79ATRv3053414@lurza.secnetix.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


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.

That won't work if another process is trying to do the same
thing at the same time. They both get the same value when
they look it up, so there will be an ID collision.

Best regards
Oliver

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Being really good at C++ is like being really good
at using rocks to sharpen sticks."
-- Thant Tessman

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Stephan Szabo 2004-08-09 14:22:11 Re: Design question regarding arrays
Previous Message Michael Glaesemann 2004-08-09 10:26:27 Re: Design question regarding arrays