Re: Use get_call_result_type() more widely - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Use get_call_result_type() more widely
Date
Msg-id CALj2ACVHZUKH50nY=bQU5Vj-Pe30Ggq9SY+B-LvXM-10BJ=V0g@mail.gmail.com
Whole thread Raw
In response to Re: Use get_call_result_type() more widely  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Use get_call_result_type() more widely
List pgsql-hackers
On Tue, Dec 20, 2022 at 1:41 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Michael Paquier <michael@paquier.xyz> writes:
> > On Mon, Dec 19, 2022 at 07:41:27PM +0530, Bharath Rupireddy wrote:
> >> 0002 - gets rid of an unnecessary call to BlessTupleDesc()
> >> after get_call_result_type().
>
> > Hmm.  I am not sure whether this is right, actually..
>
> Hmm ... at least one of the paths through internal_get_result_type
> is intentionally blessing the result tupdesc:
>
>             if (tupdesc->tdtypeid == RECORDOID &&
>                 tupdesc->tdtypmod < 0)
>                 assign_record_type_typmod(tupdesc);
>
> but it's not clear if they all do, and the comments certainly
> aren't promising it.

It looks to be safe to get rid of BlessTupleDesc() after
get_call_result_type() for the functions that have OUT parameters and
return 'record' type. This is because, the
get_call_result_type()->internal_get_result_type()->build_function_result_tupdesc_t()
returns non-NULL tupdesc for such functions and all the functions that
0002 patch touches are having OUT parameters and their return type is
'record'. I've also verified with Assert(tupdesc->tdtypmod >= 0); -
https://github.com/BRupireddy/postgres/tree/test_for_tdypmod_init_v1.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Force streaming every change in logical decoding
Next
From: gkokolatos@pm.me
Date:
Subject: Re: Add LZ4 compression in pg_dump