Search Postgresql Archives

pl/pgsql perform and execute return wrong values...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux