Does IMMUTABLE have any effect on functions?
От | Thomas Schoen |
---|---|
Тема | Does IMMUTABLE have any effect on functions? |
Дата | |
Msg-id | 42270E5D.3020607@vitrado.de обсуждение исходный текст |
Ответы |
Re: Does IMMUTABLE have any effect on functions?
Re: Does IMMUTABLE have any effect on functions? |
Список | pgsql-general |
Hi, i wonder if the attribute IMMUTABLE has any effect on functions. Maybe its not implemented yet? I tried the following: CREATE TABLE foo (bar int4); CREATE FUNCTION foo(int4) RETURNS int4 AS ' INSERT INTO foo (bar) VALUES ($1); SELECT $1; ' LANGUAGE 'sql' IMMUTABLE; ...now without any transaction... select * from foo(1); foo ----- 1 (1 row) SELECT * FROM foo; bar ----- 1 (1 row) select * from foo(1); foo ----- 1 (1 row) SELECT * FROM foo; bar ----- 1 1 (1 row) In my expectations the 2nd function call should not have added a new row to table "foo", beacause it was called with the same parameter and is immutable. The same happens when i try to call the function twice within a single transaction. Maybe the "IMMUTABLE" attribute is just some sort of comment? greets, Tom Schön
В списке pgsql-general по дате отправления: