I cant get the IMMUTABLE modifier meaning. The 'testme' IMMUTABLE function is invoked 3 times in the following query:
# select testme(1), testme(1), testme(1); NOTICE: called NOTICE: called NOTICE: called testme | testme | testme --------+--------+-------- ret | ret | ret (1 row) Why is so ? shouldn't the IMMUTABLE keywork make it a single call ? >From the 8.0 manual : IMMUTABLE indicates that the function always returns the same result when given the same argument values; that is, it does not do database lookups or otherwise use information not directly present in its argument list. If this option is given, any call of the function with all-constant arguments can be immediately replaced with the function value. The function definition: CREATE OR REPLACE FUNCTION testme(integer) RETURNS text AS ' BEGIN RAISE NOTICE ''called''; return ''ret''::text; END ' LANGUAGE 'plpgsql' IMMUTABLE STRICT; PostgreSQL version 8.0.0 --strk; ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org