> Thank you, fmgr_info() looks like the best place to do the parallel safety 
> check.
> Having a quick look at its callers, I didn't find any concerning place (of 
> course,
> we can't be relieved until the regression test succeeds.)  Also, with 
> fmgr_info(),
> we don't have to find other places to add the check to deal with functions 
> calls
> in execExpr.c and execExprInterp.c.  This is beautiful.
> 
> But the current fmgr_info() does not check the parallel safety of builtin
> functions.  It does not have information to do that.  There are two options.
> Which do you think is better?  I think 2.
> 
> 1) fmgr_info() reads pg_proc like for non-builtin functions This ruins the 
> effort
> for the fast path for builtin functions.  I can't imagine how large the 
> adverse
> impact on performance would be, but I'm worried.

For approach 1): I think it could result in infinite recursion.

For example:
If we first access one built-in function A which have not been cached, 
it need access the pg_proc, When accessing the pg_proc, it internally still 
need some built-in function B to scan.
At this time, if B is not cached , it still need to fetch function B's parallel 
flag by accessing the pg_proc.proparallel.
Then it could result in infinite recursion. 

So, I think we can consider the approach 2)

Best regards,
houzj


Reply via email to