Tom Lane wrote:
> The minimum-code-change solution would be to run around and try to make
> sure every such expression gets passed through eval_const_expressions()
> before we try to execute it. This is probably doable (looking for calls
> to fix_opfuncids would be a good guide) but it seems like the potential
> for errors of omission is large, particularly in third-party add-ons.
That seems ok to me. Calling eval_const_expressions() in ALTER COLUMN
and elsewhere is a good idea for performance reasons as well.
I can only find one more call to fix_opfuncids, where we're not already
calling eval_const_expressions(): GetDomainConstraints(). Adding a
eval_const_expressions() call to ExecPrepareExpr() would take care of
the ALTER COLUMN and many other cases where we have a problem now.
I can't imagine a third-party add-on so tightly integrated with the
backend that it needs to mess with Expr nodes, and call fix_opfuncids(). ExecPrepareExpr, maybe, but if we fix that as
Ipresume we would, the
add-ons wouldn't be affected.
Overall, I don't see much potential for bugs-of-omission. You could put
a comment at the top of fix_opfuncids() as a reminder that outside the
executor you need to call eval_const_expressions() too.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com