Re: any way for a transaction to "see" inserts done earlier in the transaction? - Mailing list pgsql-general

From Susan Cassidy
Subject Re: any way for a transaction to "see" inserts done earlier in the transaction?
Date
Msg-id CAE3Q8o=LZPFiauc+3MjHhu3CZr5PSq6k5XUFdjfDgzQ=__FBNg@mail.gmail.com
Whole thread Raw
In response to Re: any way for a transaction to "see" inserts done earlier in the transaction?  (Steven Schlansker <steven@likeness.com>)
Responses Re: any way for a transaction to "see" inserts done earlier in the transaction?  (Susan Cassidy <susan.cassidy@decisionsciencescorp.com>)
Re: any way for a transaction to "see" inserts done earlier in the transaction?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: any way for a transaction to "see" inserts done earlier in the transaction?  (David G Johnston <david.g.johnston@gmail.com>)
Re: any way for a transaction to "see" inserts done earlier in the transaction?  (Rajeev rastogi <rajeev.rastogi@huawei.com>)
List pgsql-general
It is a fairly large and complex Perl program, so no, not really.

I do an insert via a function, which returns the new id, then later I try to SELECT on that id, and it doesn't find it.

Could it be because the insert is done inside a function?

Susan


On Wed, Apr 16, 2014 at 4:58 PM, Steven Schlansker <steven@likeness.com> wrote:


>> On Wed, Apr 16, 2014 at 4:31 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Susan Cassidy <susan.cassidy@decisionsciencescorp.com> writes:
>> > Is there any way to let a transaction "see" the inserts that were done
>> > earlier in the transaction?
>>
>> It works that way automatically, as long as you're talking about separate
>> statements within one transaction.
>>
>>                         regards, tom lane

> On Apr 16, 2014, at 4:53 PM, Susan Cassidy <susan.cassidy@decisionsciencescorp.com> wrote:
> Well, it isn't working for me right now.  It can't "see" a row that was inserted earlier in the transaction.  It is a new primary key, and when I SELECT it, it isn't found.
>

Can you share the code that does not work with us?  Preferably as a small self-contained example.


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: any way for a transaction to "see" inserts done earlier in the transaction?
Next
From: Susan Cassidy
Date:
Subject: Re: any way for a transaction to "see" inserts done earlier in the transaction?