Re: non-cachable 'C' language functions - Mailing list pgsql-sql

From Tom Lane
Subject Re: non-cachable 'C' language functions
Date
Msg-id 18552.966043930@sss.pgh.pa.us
Whole thread Raw
In response to non-cachable 'C' language functions  (Forest Wilkinson <fspam@home.com>)
List pgsql-sql
Forest Wilkinson <fspam@home.com> writes:
> Is my understanding correct?  What should I do about it?  The postgresql
> 6.5.2 docs for CREATE FUNCTION don't tell me how to make my functions
> non-cachable.

6.5 doesn't pay any attention to proiscachable, AFAIR.  7.0 does, but
it defaults to assuming proiscachable = FALSE; you have to say
"with (iscachable)" in CREATE FUNCTION to get the other behavior.

There is a problem in both versions that WHERE clauses containing
no variables (table fields) will be assumed to be constants even
if they contain non-cachable function calls :-(.  Thus, for example,select * from foo where random() < 0.5
doesn't work as desired.  I plan to fix this for 7.1.

Offhand I don't see a use for a nextval-like function in WHERE,
so you're probably safe with both 6.5 and 7.0.
        regards, tom lane


pgsql-sql by date:

Previous
From: "David Lloyd-Jones"
Date:
Subject: Week of the Year?
Next
From: "David Lloyd-Jones"
Date:
Subject: Re: Week of the Year?