From: | Clemens Schwaighofer <clemens(dot)schwaighofer(at)e-graphics(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpgsql function with update and seeing changed data from outside during run |
Date: | 2011-06-10 01:05:24 |
Message-ID: | BANLkTi=nDDFotQFne_TqE+xthGbBROo61Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2011/6/9 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>> On Thu, Jun 9, 2011 at 4:46 AM, Craig Ringer
>> <craig(at)postnewspapers(dot)com(dot)au> wrote:
>>> (as far as I know) It's not possible for a function to see data committed by
>>> other transactions since that function began executing, whether or not those
>>> other transactions have committed.
>
>> This is not correct. Yes, a snapshot is created, but that doesn't
>> prevent you from seeing external changes. I have in fact many times
>> relied on being able to block in a pl/pgsql loop and wait for a record
>> to be set or something like that.
>
> Note that the function needs to be declared VOLATILE for that to work.
>
> But I believe the OP's question was the other way around: he wanted to
> be able to see changes made by a function from elsewhere, before the
> function completes. That's not possible, unless you resort to hacks
> like using dblink to get the effect of autonomous subtransactions.
Thanks, seems my only way would be to try dblink then.
--
★ Clemens 呉 Schwaighofer
★ IT Engineer/Web Producer/Planning
★ E-Graphics Communications SP Digital
★ 6-17-2 Ginza Chuo-ku, Tokyo 104-8167, JAPAN
★ Tel: +81-(0)3-3545-7706
★ Fax: +81-(0)3-3545-7343
★ http://www.e-gra.co.jp
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2011-06-10 03:43:11 | Re: WAL shipping replication server re-sync |
Previous Message | Alvaro Herrera | 2011-06-09 21:43:27 | Re: Postmaster holding unlinked files for pg_largeobject table |