Re: dirty read from plpgsql

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: depesz(at)depesz(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dirty read from plpgsql
Date: 2011-07-13 13:29:52
Message-ID: CAHnozTitEUku_pevBL-CQ1Cb+pDCuL_dGP3UJ3U6t6p01xBdpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

erm, you're right (re-tested that today)
I don't know what happened the other day. The query updating the flag
would not return until the test function was done.
I must have made the test duration too short, so that it was only appearances.
whatever, it works. thanks.

WBL

On Wed, Jul 6, 2011 at 2:36 PM, hubert depesz lubaczewski
<depesz(at)depesz(dot)com> wrote:
> On Wed, Jul 06, 2011 at 12:54:21PM +0200, Willy-Bas Loos wrote:
>> I'd like to do a dirty read from plpgsql, so that i can stop the function
>> that is in a long loop without rolling back the work that it did.
>> All i want to read is a flag that says 'stop'.
>
> this doesn't need dirty read.
> just read committed.
> make table with flags, and insert there row which says "stop". make sure
> the insert gets committed.
>
> every so often, in your function check flags in the table, and since the
> change got committed - it will be visible, and function will stop.
>
> Best regards,
>
> depesz
>
> --
> The best thing about modern society is how easy it is to avoid contact with it.
>                                                             http://depesz.com/
>

--
"Patriotism is the conviction that your country is superior to all
others because you were born in it." -- George Bernard Shaw

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-07-13 13:49:46 Re: plpgsql function confusing behaviour
Previous Message Caleb Palmer 2011-07-13 13:02:48 Web-based Graphical Query Building Tool for PostgreSQL