Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group