Re: Some more function-default issues - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Some more function-default issues
Date
Msg-id 496369B7.5010608@enterprisedb.com
Whole thread Raw
In response to Some more function-default issues  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Some more function-default issues  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Bernd Helmle
Date:
Subject: Re: Time to finalize patches for 8.4 beta
Next
From: Tom Lane
Date:
Subject: Re: Bugs during ProcessCatchupEvent()