From: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
---|---|
To: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Subject: | Re: [PATCH] Split varlena.c into varlena.c and bytea.c |
Date: | 2025-06-16 10:33:20 |
Message-ID: | CAJ7c6TM3ws1_JSSthzv3=JK7ed47Q0=1TqdsUB=+CWyMeuTr2g@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Peter,
> >> The proposed patch extracts the code dealing with bytea from varlena.c
> >> into a separate file, as proposed previously [1]. It merely changes
> >> the location of the existing functions. There are no other changes.
> >
> > Rebased.
>
> I think this is reasonable. varlena.c is pretty big, and bytea is a
> reasonable subset to take out. We already have a corresponding header
> file bytea.h, so the naming fits.
>
> I wonder if makeStringAggState() is still useful. This was factored out
> so that it could be shared between bytea_string_agg_transfn() and
> string_agg_transfn(), but now that these are in separate files, it seems
> to me that it might be easier now to just write the required code inline.
Agree. I assume you meant only bytea.c. Since varlena.c uses
makeStringAggState() in several places I choose to keep it there.
> Here are some refinements to the includes:
>
> --- a/src/backend/utils/adt/bytea.c
> +++ b/src/backend/utils/adt/bytea.c
> @@ -15,13 +15,20 @@
> #include "postgres.h"
>
> #include "access/detoast.h"
> -#include "catalog/pg_collation.h"
> +#include "catalog/pg_collation_d.h"
> +#include "catalog/pg_type_d.h"
> #include "common/int.h"
> -#include "funcapi.h"
> +#include "fmgr.h"
> #include "libpq/pqformat.h"
> +#include "port/pg_bitutils.h"
> #include "utils/builtins.h"
> #include "utils/bytea.h"
> +#include "utils/fmgroids.h"
> +#include "utils/fmgrprotos.h"
> +#include "utils/memutils.h"
> +#include "utils/sortsupport.h"
> #include "utils/varlena.h"
> +#include "varatt.h"
>
> Especially funcapi.h was apparently not used. The other additions are
> required includes that came previously via indirect includes.
Thanks, fixed. clangd complained that utils/fmgroids.h is not going to
be used, as it complained about funcapi.h before. So I choose not to
include fmgroids.h.
PFA patch v3.
--
Best regards,
Aleksander Alekseev
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Split-varlena.c-into-varlena.c-and-bytea.c.patch | application/octet-stream | 59.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksander Alekseev | 2025-06-16 11:08:54 | [PATCH] Remove unused #include's in src/backend/utils/adt/* |
Previous Message | Evgeniy Gorbanev | 2025-06-16 09:51:18 | Re: No error checking when reading from file using zstd in pg_dump |