From: | Jeff Anto <antojf2001(at)yahoo(dot)fr> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | "select myfunc(fields) from my table" inside plpgslq proc |
Date: | 2002-03-07 12:26:28 |
Message-ID: | 20020307122628.43429.qmail@web20903.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
the following is very surprising to me.
It seems that semantic of
select INTO var myfunc(...) from ... are different in
plpgsql program than pure sql
select myfunc(...) from ...
should the former take into account only one rows
while the latter take into account all rows ?
I am sure that in past version (7.1.2 ?) both were
equivalent...
DROP function print(int4);
CREATE function print(int4) returns bool AS'
BEGIN
RAISE NOTICE ''print arg: %'',$1;
RETURN true;
END;
' language 'plpgsql';
drop table mytable;
create table mytable(num int4);
insert into mytable VALUES ('1');
insert into mytable VALUES ('2');
-- this is OK of course:
SELECT print(num) FROM mytable;
DROP FUNCTION test();
CREATE FUNCTION test() RETURNS OPAQUE AS '
DECLARE
lost bool;
BEGIN
SELECT into lost print(num) FROM mytable;
RETURN NEW;
END;
' language 'plpgsql';
DROP TABLE test;
CREATE TABLE test(foo int4);
CREATE TRIGGER test AFTER INSERT ON test
FOR EACH ROW EXECUTE PROCEDURE test()
;
-- the following is surprising, comparing to
-- the previous pure SQL select:
INSERT INTO test VALUES ('1');
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | news | 2002-03-07 12:46:03 | Re: NEWBIE: Date format/timestamp issue ? |
Previous Message | Oliver Elphick | 2002-03-07 12:08:21 | Re: Have problems with 7.1 -> 7.2 upgrade |