[postgis-users] add IMMUTALBE to Pg 7.3+ functions

Carl Anderson carl.anderson at vadose.org
Tue Feb 17 18:37:29 PST 2004


In Postgres 7.3  modifiers where added to function declarations

"IMMUTABLE" indicates to Postgres that the function will always return  
the same output given the same input (and does not read other tables)

Can we add this to the declaration of functions for Pg version 7.3+?
That would allow indexing on the geospatial functions.

CREATE FUNCTION x(geometry)
        RETURNS float8
        AS '@MODULE_FILENAME@','x_point'
        LANGUAGE 'C' STRICT IMMUTABLE;

that way in Pg 7.3+ we can

CREATE INDEX my_X_ind on mytab(area2d(the_geom));

versions of Pg prior to 7.3 use WITH (iscachable) which is suppose to  
still work in version 7.3 and later but is not in concert with the  
underlying SQL spec.

CREATE FUNCTION x(geometry)
        RETURNS float8
        AS '@MODULE_FILENAME@','x_point'
        LANGUAGE 'C' with(isstrict) with(iscachable);

as alway thanks for a great set of tools.

C.


More information about the postgis-users mailing list