Re: non-cachable 'C' language functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Forest Wilkinson <fspam(at)home(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: non-cachable 'C' language functions
Date: 2000-08-12 01:32:10
Message-ID: 18552.966043930@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Forest Wilkinson <fspam(at)home(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Lloyd-Jones 2000-08-12 02:48:20 Re: Week of the Year?
Previous Message David Lloyd-Jones 2000-08-12 01:27:43 Week of the Year?