From: | "Alexander Blüm" <mailinglists1(at)gmx(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | pl/pgsql perform and execute return wrong values... |
Date: | 2004-03-29 16:40:47 |
Message-ID: | 23905.1080578447@www23.gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
CREATE OR REPLACE FUNCTION testifinserted(text) RETURNS bool AS '
DECLARE
testtext ALIAS FOR $1;
anfr text;
BEGIN
anfr := ''SELECT bla FROM testtabelle WHERE bla = '' ||
quote_literal(testtext);
RAISE NOTICE ''%'', anfr; -- to show the request
EXECUTE anfr;
IF FOUND THEN
RAISE NOTICE ''jupp, % gefunden in testtabelle'', testtext;
RETURN true;
ELSE
RETURN false;
END IF;
END;
' LANGUAGE plpgsql;
test=> SELECT * FROM testtabelle;
bla
-----
muh
(1 row)
test=> SELECT testifinserted('muh');
NOTICE: SELECT bla FROM testtabelle WHERE bla = 'muh'
testifinserted
----------------
f
(1 row)
------------------------------------
WHY ????
seems like PERFORM always returns TRUE and EXECUTE always FALSE...
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2004-03-29 17:26:12 | Re: PG vs MySQL |
Previous Message | Uwe C. Schroeder | 2004-03-29 16:09:49 | Re: PG vs MySQL |