Re: dirty read from plpgsql - Mailing list pgsql-general

From Willy-Bas Loos
Subject Re: dirty read from plpgsql
Date
Msg-id CAHnozTitEUku_pevBL-CQ1Cb+pDCuL_dGP3UJ3U6t6p01xBdpw@mail.gmail.com
Whole thread Raw
In response to Re: dirty read from plpgsql  (hubert depesz lubaczewski <depesz@depesz.com>)
List 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@depesz.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

pgsql-general by date:

Previous
From: Caleb Palmer
Date:
Subject: Web-based Graphical Query Building Tool for PostgreSQL
Next
From: Merlin Moncure
Date:
Subject: Re: plpgsql function confusing behaviour