PLPGSQL and FOUND stange behaviour after EXECUTE

From: Константин <beholder(at)mmska(dot)ru>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: PLPGSQL and FOUND stange behaviour after EXECUTE
Date: 2004-09-30 16:02:59
Message-ID: 000001c4a706$f56229b0$b632030a@kobzev
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 THEN
RAISE 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 INSERTED
test_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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-09-30 16:26:02 Re: PLPGSQL and FOUND stange behaviour after EXECUTE
Previous Message Hussein Patni 2004-09-30 15:11:44 semicolon not required on END statement