Re: BUG #11637: SQL function volatility is ignored on index creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: will(at)willglynn(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11637: SQL function volatility is ignored on index creation
Date: 2014-10-10 17:58:36
Message-ID: 29554.1412963916@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

will(at)willglynn(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message cg 2014-10-10 18:14:33 BUG #11638: Transaction safety fails when constraints are dropped and analyze is done
Previous Message Fabrízio de Royes Mello 2014-10-10 17:43:38 Re: schema-only -n option in pg_restore fails