From: Gaetano Mendola <mendola@bigfoot.com>
To: Bradley Kieser <brad@kieser.net>
Subject: Re: Getting the OID of inserted row in a rule
Date: Wed, 22 Sep 2004 18:11:38 +0200
Message-ID: <4151A43A.2080805@bigfoot.com> (raw)
In-Reply-To: <41519A7E.8050803@kieser.net>
References: <41517C66.9040709@kieser.net>
<20040922152643.GA92429@winnie.fuhr.org>
<41519A7E.8050803@kieser.net>
Bradley Kieser wrote:
> Hi Michael,
>
> But what if another insert happens in the mean time? Then the sequence
> would have advanced that the data will be scrambled. |Given that this
> could be a very active dataset, that situation is almost certain to occur.
>
I think you are wrong, the sequence are not affected by transactions ( on rollback
the serial is not rolledback ), but however the value are isolated between transactions.
I don't see the problem:
#section1
begin;
insert into test (b) values ( 1 );
#section2
begin;
insert into test (b) values ( 1 );
#section1
select currval('test_a_seq'); <==== give 1
#section2
select currval('test_a_seq'); <==== give 2
Regards
Gaetano Mendola
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mendola@bigfoot.com, brad@kieser.net
Subject: Re: Getting the OID of inserted row in a rule
In-Reply-To: <4151A43A.2080805@bigfoot.com>
References: <41517C66.9040709@kieser.net> <20040922152643.GA92429@winnie.fuhr.org> <41519A7E.8050803@kieser.net> <4151A43A.2080805@bigfoot.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox