Missing deconstruct_array_builtin usage

Lists: pgsql-hackers
From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Missing deconstruct_array_builtin usage
Date: 2024-10-11 05:37:07
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Hi hackers,

While working on [1], I noticed that we missed using deconstruct_array_builtin()
in 062a8444242.

Indeed, d746021de1 added construct_array_builtin and deconstruct_array_builtin
but , later on, 062a8444242 made use of deconstruct_array for TEXTOID.

Please find attached a tiny patch to add the $SUBJECT.

That does not fix any issues, it just removes this unnecessary hardcoded
parameters related to TEXTOID passed to deconstruct_array.

A quick check:

$ git grep construct_array | grep OID | grep -v builtin
src/backend/catalog/pg_publication.c: deconstruct_array(arr, TEXTOID, -1, false, TYPALIGN_INT,
src/backend/utils/fmgr/funcapi.c: * For the OID and char arrays, we don't need to use deconstruct_array()

shows that this is the "only" miss since d746021de1, so I still don't think it
has to be more "complicated" than it is currently (as already mentioned by Peter
in [2]).

[1]: https://www.postgresql.org/message-id/ZwdK1UYdLn/zFMHy%40ip-10-97-1-34.eu-west-3.compute.internal
[2]: https://www.postgresql.org/message-id/2914356f-9e5f-8c59-2995-5997fc48bcba%40enterprisedb.com

Looking forward to your feedback,

Regards,

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

Attachment Content-Type Size
v1-0001-Missing-deconstruct_array_builtin-usage.patch text/x-diff 1.2 KB

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing deconstruct_array_builtin usage
Date: 2024-10-12 00:43:04
Message-ID: CAD21AoCERkwmttY44dqUw=m_9QCctu7W+p6B7w_VqxRJA1Qq_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

On Thu, Oct 10, 2024 at 10:37 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> Hi hackers,
>
> While working on [1], I noticed that we missed using deconstruct_array_builtin()
> in 062a8444242.
>
> Indeed, d746021de1 added construct_array_builtin and deconstruct_array_builtin
> but , later on, 062a8444242 made use of deconstruct_array for TEXTOID.
>
> Please find attached a tiny patch to add the $SUBJECT.
>
> That does not fix any issues, it just removes this unnecessary hardcoded
> parameters related to TEXTOID passed to deconstruct_array.

+1 for better consistency and simplicity.

>
> A quick check:
>
> $ git grep construct_array | grep OID | grep -v builtin
p> src/backend/catalog/pg_publication.c:
deconstruct_array(arr, TEXTOID, -1, false, TYPALIGN_INT,
> src/backend/utils/fmgr/funcapi.c: * For the OID and char arrays, we don't need to use deconstruct_array()
>
> shows that this is the "only" miss since d746021de1, so I still don't think it
> has to be more "complicated" than it is currently (as already mentioned by Peter
> in [2]).

It seems that src/backend/utils/adt/float.c file still has functions
that can use [de]construct_array_builtin(), for example
float8_combine(). I think it's an oversight of d746021de1.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com


From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing deconstruct_array_builtin usage
Date: 2024-10-14 06:12:32
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

On Fri, Oct 11, 2024 at 05:43:04PM -0700, Masahiko Sawada wrote:
> Hi,
>
> On Thu, Oct 10, 2024 at 10:37 PM Bertrand Drouvot
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> >
> > Hi hackers,
> >
> > While working on [1], I noticed that we missed using deconstruct_array_builtin()
> > in 062a8444242.
> >
> > Indeed, d746021de1 added construct_array_builtin and deconstruct_array_builtin
> > but , later on, 062a8444242 made use of deconstruct_array for TEXTOID.
> >
> > Please find attached a tiny patch to add the $SUBJECT.
> >
> > That does not fix any issues, it just removes this unnecessary hardcoded
> > parameters related to TEXTOID passed to deconstruct_array.
>
> +1 for better consistency and simplicity.
>
> >
> > A quick check:
> >
> > $ git grep construct_array | grep OID | grep -v builtin
> p> src/backend/catalog/pg_publication.c:
> deconstruct_array(arr, TEXTOID, -1, false, TYPALIGN_INT,
> > src/backend/utils/fmgr/funcapi.c: * For the OID and char arrays, we don't need to use deconstruct_array()
> >
> > shows that this is the "only" miss since d746021de1, so I still don't think it
> > has to be more "complicated" than it is currently (as already mentioned by Peter
> > in [2]).
>
> It seems that src/backend/utils/adt/float.c file still has functions
> that can use [de]construct_array_builtin(), for example
> float8_combine(). I think it's an oversight of d746021de1.

Thanks for looking at it.

Good catch, please find attached v2 taking care of those. I looked at the
remaining [de]construct_array() usages and that looks ok to me.

Please note that v1 has been committed (099c572d33).

Regards,

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

Attachment Content-Type Size
v2-0001-construct_array_builtin-usage-for-FLOAT8OID.patch text/x-diff 3.1 KB

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing deconstruct_array_builtin usage
Date: 2024-10-14 10:05:18
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 14.10.24 08:12, Bertrand Drouvot wrote:
>> It seems that src/backend/utils/adt/float.c file still has functions
>> that can use [de]construct_array_builtin(), for example
>> float8_combine(). I think it's an oversight of d746021de1.
> Thanks for looking at it.
>
> Good catch, please find attached v2 taking care of those. I looked at the
> remaining [de]construct_array() usages and that looks ok to me.

This looks good to me. I can't think of a reason why it was not
included in the original patch.


From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing deconstruct_array_builtin usage
Date: 2024-10-14 16:55:24
Message-ID: CAD21AoAm=mAh2o=MEN+vS=gRMakjxhVTsbV+q8cC4HbScU-OfQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 14, 2024 at 3:05 AM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 14.10.24 08:12, Bertrand Drouvot wrote:
> >> It seems that src/backend/utils/adt/float.c file still has functions
> >> that can use [de]construct_array_builtin(), for example
> >> float8_combine(). I think it's an oversight of d746021de1.
> > Thanks for looking at it.
> >
> > Good catch, please find attached v2 taking care of those. I looked at the
> > remaining [de]construct_array() usages and that looks ok to me.
>
> This looks good to me. I can't think of a reason why it was not
> included in the original patch.

Thank you for reviewing the patch. Pushed (v2 patch).

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com