Re: any way for a transaction to "see" inserts done earlier in the transaction?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: any way for a transaction to "see" inserts done earlier in the transaction?
Date: 2014-04-17 00:13:44
Message-ID: 534F1CB8.5060007@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Not to say that perl and complex are redundant, but does the id go away
after the NOT FOUND exception?

On 04/16/2014 06:08 PM, Susan Cassidy wrote:
> The function does a select to see if the id number exists, and it
> fails. NOT FOUND causes a RAISE EXCEPTION.
>
> Susan
>
>
> On Wed, Apr 16, 2014 at 5:05 PM, Susan Cassidy
> <susan(dot)cassidy(at)decisionsciencescorp(dot)com
> <mailto:susan(dot)cassidy(at)decisionsciencescorp(dot)com>> wrote:
>
> 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(at)likeness(dot)com <mailto:steven(at)likeness(dot)com>> wrote:
>
>
>
> >> On Wed, Apr 16, 2014 at 4:31 PM, Tom Lane
> <tgl(at)sss(dot)pgh(dot)pa(dot)us <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
> >> Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com
> <mailto:susan(dot)cassidy(at)decisionsciencescorp(dot)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(dot)cassidy(at)decisionsciencescorp(dot)com
> <mailto:susan(dot)cassidy(at)decisionsciencescorp(dot)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.
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2014-04-17 00:13:48 Re: any way for a transaction to "see" inserts done earlier in the transaction?
Previous Message Susan Cassidy 2014-04-17 00:08:34 Re: any way for a transaction to "see" inserts done earlier in the transaction?