dirty read from plpgsql

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: dirty read from plpgsql
Date: 2011-07-06 10:54:21
Message-ID: CAHnozTgBsXT7C+Dp6Jkymu8zaiG6EwtKo8Zj61O4ExA4NK4FNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-07-06 11:17:11 Re: dirty read from plpgsql
Previous Message Florian Weimer 2011-07-06 09:34:50 Generic terminal-based data browsing & entry