Skip site navigation (1) Skip section navigation (2)

Re: Getting the OID of inserted row in a rule

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Bradley Kieser <brad(at)kieser(dot)net>
Subject: Re: Getting the OID of inserted row in a rule
Date: 2004-09-22 16:11:38
Message-ID: 4151A43A.2080805@bigfoot.com (view raw or flat)
Thread:
Lists: pgsql-admin
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






In response to

pgsql-admin by date

Next:From: Bradley KieserDate: 2004-09-22 16:15:40
Subject: Re: Getting the OID of inserted row in a rule
Previous:From: Michael FuhrDate: 2004-09-22 15:59:22
Subject: Re: Getting the OID of inserted row in a rule

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group