Re: BUG #11637: SQL function volatility is ignored on index creation - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #11637: SQL function volatility is ignored on index creation
Date
Msg-id 29554.1412963916@sss.pgh.pa.us
Whole thread Raw
In response to BUG #11637: SQL function volatility is ignored on index creation  (will@willglynn.com)
Responses Re: BUG #11637: SQL function volatility is ignored on index creation  (Will Glynn <will@willglynn.com>)
List pgsql-bugs
will@willglynn.com writes:
> The CREATE INDEX documentation and the wording of that error message
> strongly imply that it's a function's volatility *marking* that is
> important, but in at least some situations, PostgreSQL ignores
> pg_proc.provolatile='v' and allows index creation anyway if the function is
> in fact immutable. I suspect this qualifier is ignored because the SQL
> function call is being inlined prior to the CheckMutability() in
> ComputeIndexAttrs(); there isn't a volatile function call, just an immutable
> expression.

That's correct, and it's intentional behavior, not a bug (cf commit
5a86e5e1930d95f495a134000512d6ca22064338).  Refusing the CREATE would
just be pedantry AFAICS.

            regards, tom lane

pgsql-bugs by date:

Previous
From: will@willglynn.com
Date:
Subject: BUG #11637: SQL function volatility is ignored on index creation
Next
From: Alon
Date:
Subject: Re: Re: [BUGS] Re: [BUGS] Re: BUG #11431: Failing to backup and restore a Windows postgres database, with Norwegian Bokmål locale.