dirty read from plpgsql - Mailing list pgsql-general

From Willy-Bas Loos
Subject dirty read from plpgsql
Date
Msg-id CAHnozTgBsXT7C+Dp6Jkymu8zaiG6EwtKo8Zj61O4ExA4NK4FNA@mail.gmail.com
Whole thread Raw
Responses Re: dirty read from plpgsql  (Craig Ringer <craig@postnewspapers.com.au>)
Re: dirty read from plpgsql  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
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'.
I've figured 2 ways of doing that, both of which i don't like very much.
* with a sequence: while value = nextval(seq)-1 loop  . To stop, run nextval(seq) from another session.
* with copy: run copy from within the function. To stop, overwrite the file that is to be copied into the function.

other than that, transaction safety prevents us from reading anything that is done after the function was called.
Any tips?

"use a different language" has occurred to me. It is an option, especially if there's no better way to stop plpgsql.

cheers,

WBL


--
"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: Florian Weimer
Date:
Subject: Generic terminal-based data browsing & entry
Next
From: Craig Ringer
Date:
Subject: Re: dirty read from plpgsql