From: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | problem with FOUND and EXECUTE in pl/pgsql |
Date: | 2009-06-03 19:42:53 |
Message-ID: | Pine.LNX.4.64.0906032146160.17118@sn.sai.msu.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi there,
seems I don't understand how FOUND variable in pl/pgsql function defined,
when I use EXECUTE of PERFORM. There is no problem when I use plain SQL.
Below is a test I did for 8.4beta2. This is simplified script and I can
use plain SQL, but in my project I need EXECUTE.
CREATE TABLE db (a INT, b TEXT);
INSERTYTT INTO db VALUES(1,'one');
CREATE OR REPLACE FUNCTION merge_db(key INT, data TEXT) RETURNS VOID AS
$$
BEGIN
EXECUTE 'UPDATE db SET b='||quote_literal(data)||' WHERE a='||key;
RAISE NOTICE 'found:%',FOUND;
END;
$$
LANGUAGE plpgsql;
After successfull update I expected TRUE, as with plain INSERT
(instead of EXECUTE), but FOUND is FALSE !
=# SELECT merge_db(1, 'two');
NOTICE: found:f
merge_db
----------
(1 row)
=# select * from db;
a | b
---+-----
1 | two
(1 row)
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru)
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83
From | Date | Subject | |
---|---|---|---|
Next Message | Grzegorz Jaśkiewicz | 2009-06-03 19:48:11 | Re: High I/O writes activity on disks causing images on browser to lag and not load |
Previous Message | Jennifer Trey | 2009-06-03 19:41:31 | Re: High I/O writes activity on disks causing images on browser to lag and not load |