Re: [18] Policy on IMMUTABLE functions and Unicode updates

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org, Daniel Verite <daniel(at)manitou-mail(dot)org>, Noah Misch <noah(at)leadboat(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jeremy Schneider <schneider(at)ardentperf(dot)com>, LaurenzAlbe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: [18] Policy on IMMUTABLE functions and Unicode updates
Date: 2024-07-16 20:18:50
Message-ID: ca70caa1-7ef5-4ed7-9304-4db456b25391@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/16/24 16:16, Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>> So you are proposing we add STATIC to VOLATILE/STABLE/IMMUTABLE (in the
>> third position before IMMUTABLE), give it IMMUTABLE semantics, mark
>> builtin functions that deserve it, and document with suitable caution
>> statements?
>
> What is the point of that, exactly?
>
> I'll agree that the user documentation could use some improvement
> in how it describes the volatility levels, but I do not see how
> it will reduce anybody's confusion to invent multiple aliases for
> what's effectively the same volatility level. Nor do I see a
> use-case for actually having multiple versions of "immutable".
> Once you've decided you can put something into an index, quibbling
> over just how immutable it is doesn't really change anything.
>
> To put this another way: the existing volatility levels were
> basically reverse-engineered from the ways that the planner could
> meaningfully treat a function: it's dangerous, it is safe enough
> to use in an index condition (which changes the number of times
> the query will evaluate it), or it's safe to constant-fold in
> advance of execution. Unless there's a fourth planner behavior that's
> worth having, we don't need a fourth level. Possibly you could
> argue that "safe to put in an index" is a different level from
> "safe to constant-fold", but I don't really agree with that.

Fair enough, but then I think we should change the documentation to not
say "forever".

--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-07-16 20:25:48 Re: Converting tab-complete.c's else-if chain to a switch
Previous Message Tom Lane 2024-07-16 20:16:09 Re: [18] Policy on IMMUTABLE functions and Unicode updates