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