Hi,

I am utterly confused now. Running the attached script on Debian:

postgresql:
  Installiert:7.5.21
  Mögliche Pakete:7.5.21
  Versions-Tabelle:
 *** 7.5.21 0
        990 ftp://ftp.gwdg.de testing/main Packages
        100 /var/lib/dpkg/status
     7.4.7-6sarge3 0
        500 ftp://ftp.gwdg.de stable/main Packages
        500 ftp://ftp.de.debian.org stable/main Packages
     7.4.7-6sarge2 0
        500 http://security.debian.org stable/updates/main Packages

gives the result below. It seems inconsistent to me with
regard to the FOUND variable. I would expect FOUND to always
be false regardless of whether I use EXECUTE or PERFORM. I
certainly do not expect it to be true for the third EXECUTE
even assuming that PERFORM may have a bug. What is it that I
am missing out on here ?

BEGIN
CREATE TABLE
CREATE FUNCTION
select * from test;
 fk_item 
---------
(0 Zeilen)

select test();
psql:00-test.sql:33: NOTICE:  running: select 1 from test where fk_item=1324314
psql:00-test.sql:33: NOTICE:  found (execute 1): f
psql:00-test.sql:33: NOTICE:  found (execute 2): f
psql:00-test.sql:33: NOTICE:  found (perform): t
psql:00-test.sql:33: NOTICE:  found (execute 3): t
 test 
------
 t
(1 Zeile)

rollback;
ROLLBACK

Thanks,
Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
begin;

create table test (fk_item integer);

create function test()
        returns boolean
        language 'plpgsql'
        as '
declare
        cmd text;
begin
        cmd := ''select 1 from test where fk_item=1324314'';
        raise notice ''running: %'', cmd;

        execute cmd;
        raise notice ''found (execute 1): %'', found;

        execute cmd;
        raise notice ''found (execute 2): %'', found;

        perform cmd;
        raise notice ''found (perform): %'', found;

        execute cmd;
        raise notice ''found (execute 3): %'', found;

        return true;
end;
';

\set ECHO queries
select * from test;
select test();

rollback;
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to