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

From: Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Steven Schlansker <steven(at)likeness(dot)com>, "pgsql-general(at)postgresql(dot)org" <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:24:55
Message-ID: CAE3Q8o=4K2Tyk1ZmWTq_XhoqMjwcya6RmdpPvQEcKRo4jvxVKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I marked it volatile, and still the next time I call the function after the
first insert, using the previous new id as as input parameter, it still
can't "find" the newly inserted id for the next go-round. Nor can any
regular SELECTs in the main program find it.

Susan

On Wed, Apr 16, 2014 at 5:18 PM, Susan Cassidy <
susan(dot)cassidy(at)decisionsciencescorp(dot)com> wrote:

> It isn't marked as one of those as all, so whatever the default is.
>
> That could be it. I'll look up the default.
>
> Thanks,
> Susan
>
>
> On Wed, Apr 16, 2014 at 5:17 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Susan Cassidy <susan(dot)cassidy(at)decisionsciencescorp(dot)com> writes:
>> > 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?
>>
>> Is the SELECT also inside a database function, and if so is that function
>> marked stable or immutable? That might explain it --- non-volatile
>> functions are intentionally designed not to notice updates that happen
>> after they start.
>>
>> regards, tom lane
>>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-04-17 00:28:22 Re: any way for a transaction to "see" inserts done earlier in the transaction?
Previous Message Susan Cassidy 2014-04-17 00:18:40 Re: any way for a transaction to "see" inserts done earlier in the transaction?