PLPGSQL and FOUND stange behaviour after EXECUTE - Mailing list pgsql-bugs

From Константин
Subject PLPGSQL and FOUND stange behaviour after EXECUTE
Date
Msg-id 000001c4a706$f56229b0$b632030a@kobzev
Whole thread Raw
Responses Re: PLPGSQL and FOUND stange behaviour after EXECUTE
List pgsql-bugs
Hello,
FreeBSD, I386, Postgres 8.0.0 beta2

Trying issuing such a plpgsql function:
Create function test_fun (suffix char(4)) returns integer as $$
DECLARE
sql text;
BEGIN
sql := 'insert into tbl' || suffix::text || ' values (1,1)';
EXECUTE sql;
IF NOT FOUND THENRAISE NOTICE 'NOT INSERTED';
END IF;
return 1;
END;
$$ LANGUAGE plpgsql;
create table tbl_a (id integer,name integer);

db# select test_fun('_a');
NOTICE:  NOT INSERTEDtest_fun
----------       1
(1 row)

db# # select * from tbl_a;id | name
----+------ 1 |    1
(1 row)

When I trying monitoring the result with GET DIAGNOSTICS - all fine, but
with FOUND it doesn't work.

Thank You in advance.

Konstantin




pgsql-bugs by date:

Previous
From: Hussein Patni
Date:
Subject: semicolon not required on END statement
Next
From: Tom Lane
Date:
Subject: Re: PLPGSQL and FOUND stange behaviour after EXECUTE