Make CREATE INDEX run expression preprocessing on a proposed index expression
before it checks whether the expression is immutable. This covers two cases
that were previously handled poorly:
1. SQL function inlining could reduce the apparent volatility of the
expression, allowing an expression to be accepted where it previously would
not have been. As an example, polymorphic functions must be marked with the
worst-case volatility they have for any argument type, but for specific
argument types they might not be so volatile, so indexing could be allowed.
(Since the planner will refuse to inline functions in cases where the
apparent volatility of the expression would increase, this won't break
any cases that were accepted before.)
2. A nominally immutable function could have default arguments that are
volatile expressions. In such a case insertion of the defaults will increase
both the apparent and actual volatility of the expression, so it is
*necessary* to check this before allowing the expression to be indexed.
Back-patch to 8.4, where default arguments were introduced.
indexcmds.c (r1.195 -> r1.196)
pgsql-committers by date
|Next:||From: Tom Lane||Date: 2010-05-27 15:59:15|
|Subject: pgsql: Make CREATE INDEX run expression preprocessing on a proposed |
|Previous:||From: Takahiro Itagaki||Date: 2010-05-27 07:59:49|
|Subject: pgsql: Mark PG_MODULE_MAGIC and PG_FUNCTION_INFO_V1 with PGDLLEXPORT |