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