Re: Remove redundant code in pl_exec.c

2022-09-09 Thread Tom Lane
Japin Li  writes:
> On Fri, 09 Sep 2022 at 23:34, Tom Lane  wrote:
>> I don't like this particularly --- it puts way too much premium on
>> the happenstance that the MakeExpandedObjectReadOnly call is the
>> very last step in the callback function.  If that needed to change,
>> we'd have a mess.

> Sorry, I don't get your mind.  Could you explain it more?  Thanks in advance!

This refactoring cannot support the situation where there is more
code to execute after MakeExpandedObjectReadOnly.

regards, tom lane




Re: Remove redundant code in pl_exec.c

2022-09-09 Thread Japin Li


On Fri, 09 Sep 2022 at 23:34, Tom Lane  wrote:
> Japin Li  writes:
>> IMO, we can invoke plpgsql_param_eval_generic in 
>> plpgsql_param_eval_generic_ro
>> to avoid the redundant.
>
> I don't like this particularly --- it puts way too much premium on
> the happenstance that the MakeExpandedObjectReadOnly call is the
> very last step in the callback function.  If that needed to change,
> we'd have a mess.
>

Sorry, I don't get your mind.  Could you explain it more?  Thanks in advance!

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.




Re: Remove redundant code in pl_exec.c

2022-09-09 Thread Tom Lane
Japin Li  writes:
> I found there are some redundant code in pl_exec.c,
> plpgsql_param_eval_generic_ro is same as plpgsql_param_eval_generic
> except it invokes MakeExpandedObjectReadOnly.

Which is exactly why it's NOT redundant.

> IMO, we can invoke plpgsql_param_eval_generic in plpgsql_param_eval_generic_ro
> to avoid the redundant.

I don't like this particularly --- it puts way too much premium on
the happenstance that the MakeExpandedObjectReadOnly call is the
very last step in the callback function.  If that needed to change,
we'd have a mess.

regards, tom lane