"select myfunc(fields) from my table" inside plpgslq proc
От | Jeff Anto |
---|---|
Тема | "select myfunc(fields) from my table" inside plpgslq proc |
Дата | |
Msg-id | 20020307122628.43429.qmail@web20903.mail.yahoo.com обсуждение исходный текст |
Ответы |
Re: "select myfunc(fields) from my table" inside plpgslq proc
Re: "select myfunc(fields) from my table" inside plpgslq |
Список | 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
В списке pgsql-general по дате отправления: