SetQuerySnapshot inside PL/PGSQL ?

From: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: SetQuerySnapshot inside PL/PGSQL ?
Date: 2003-05-15 08:30:46
Message-ID: 005801c31abc$4b3eb340$1564a8c0@ROMULUS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I really want to see newly committed data when I am INSIDE
a PL/PGSQL function. This way, if I do a LOCK on a table
and subsequently perform a SELECT after aquiring the lock,
I know I'll see the data that any previous transactions just
updated (hence they released my lock)...

So, if you don't want to do the auto 'SetQuerySnapshot' calls
as they probably should be, is there a way I can call this from
the PL/PGSQL function myself, directly? Something like this:

-------------------- 8< --------------------
CREATE OR REPLACE...
...
BEGIN
LOCK TABLE blah_blah... EXCLUSIVE MODE;
SetQuerySnapshot(); <----------- I want something like this

SELECT id
FROM table
WHERE blah blah blah ...
FOR UPDATE;

IF NOT FOUND THEN
...
ELSE
...
END IF;
END;
...
-------------------- 8< --------------------

Something like that might solve my problem whereby I'd like the
PL/pgSQL function to be able to work as if it were in READ COMMITTED
mode.

Dante

D. Dante Lorenso
dante(at)lorenso(dot)com
972-333-4139

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ewald Geschwinde 2003-05-15 09:55:35 problem
Previous Message D. Dante Lorenso 2003-05-15 08:09:45 Re: Serialization, Locking...implement processing Queue with a table