On Sun, May 16, 2010 at 1:20 PM, Robert Haas <robertmh...@gmail.com> wrote: > On Sun, May 16, 2010 at 1:11 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> Robert Haas <robertmh...@gmail.com> writes: >>> Couldn't you apply this argument to any built-in immutable function >>> whatsoever? >> >> No, only the ones that are built on top of other functions that aren't >> immutable. > > Built on top of? I don't get it. It seems like anything of the form > immutablefunction(volatilefunction()) is vulnerable to this, and you > can give a volatile function as an argument to any function you like. > If you're saying we're testing for immutability by looking only at the > outermost function call, that seems pretty broken. >
you mean we shouldn't allow this? """ select version(); version ------------------------------------------------------------------------------------------------------------------- PostgreSQL 8.4.0 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-10), 64-bit (1 row) create table t1 (col1 int); create function f1(int) returns double precision as $$ select random() * $1; $$ language sql immutable; create index idx on t1(f1(col1)); """ then, welcome to the club... there were various conversations on this same topic -- Jaime Casanova www.2ndQuadrant.com Soporte y capacitación de PostgreSQL -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers