Обсуждение: Remove "struct" markers from varlena, varatt_external and varatt_indirect

Поиск
Список
Период
Сортировка

Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Michael Paquier
Дата:
Hi all,

"struct" markers are not the style of the project for variable
declarations, and we have been historically applying these for various
declarations in the code for varlena, varatt_external and
varatt_indirect, so I would like to propose the attached patch to
clean up all this code.

This has been extracted from a larger patch I have sent a couple of
months ago, worth a cleanup of its own now that I am looking at it
again.  For reference, this has also been proposed by Tom here (see
around 0003, but the varlena bits are my own):
https://www.postgresql.org/message-id/1891064.1754681536@sss.pgh.pa.us

This cleanup leads to the attached, with the CI not complaining.  That
will also help me a bit for the other patch sets I have been playing
with related to TOAST.

Thoughts or comments?
--
Michael

Вложения

Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Michael Paquier
Дата:
On Tue, Jan 20, 2026 at 04:41:49PM +0900, Michael Paquier wrote:
> This cleanup leads to the attached, with the CI not complaining.  That
> will also help me a bit for the other patch sets I have been playing
> with related to TOAST.
>
> Thoughts or comments?

This patch has been sitting on my desk for a couple of weeks now, and
I am playing with varatt.h.  Any objections in getting rid of these
struct markers at the end as of the patch posted upthread?
--
Michael

Вложения

Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Chao Li
Дата:

> On Feb 10, 2026, at 13:12, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Tue, Jan 20, 2026 at 04:41:49PM +0900, Michael Paquier wrote:
>> This cleanup leads to the attached, with the CI not complaining.  That
>> will also help me a bit for the other patch sets I have been playing
>> with related to TOAST.
>>
>> Thoughts or comments?
>
> This patch has been sitting on my desk for a couple of weeks now, and
> I am playing with varatt.h.  Any objections in getting rid of these
> struct markers at the end as of the patch posted upthread?
> --
> Michael


This patch is a pure typedef substitution. I don’t see any functional or correctness problems introduced by it. I built
itlocally and ran “make check”, everything passed. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Shinya Kato
Дата:
On Tue, Feb 10, 2026 at 2:12 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Tue, Jan 20, 2026 at 04:41:49PM +0900, Michael Paquier wrote:
> > This cleanup leads to the attached, with the CI not complaining.  That
> > will also help me a bit for the other patch sets I have been playing
> > with related to TOAST.
> >
> > Thoughts or comments?
>
> This patch has been sitting on my desk for a couple of weeks now, and
> I am playing with varatt.h.  Any objections in getting rid of these
> struct markers at the end as of the patch posted upthread?

I have no objections, but it looks like a rebase is required.

--
Best regards,
Shinya Kato
NTT OSS Center



Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Andreas Karlsson
Дата:
On 1/20/26 8:41 AM, Michael Paquier wrote:
> Thoughts or comments?
It seems like an improvement to me. I do not see any reason why these 
three should not follow our general rule of preferring using "x" over 
"struct x" when referring to a type.

Andreas




Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Álvaro Herrera
Дата:
On 2026-Feb-10, Michael Paquier wrote:

> On Tue, Jan 20, 2026 at 04:41:49PM +0900, Michael Paquier wrote:
> > This cleanup leads to the attached, with the CI not complaining.  That 
> > will also help me a bit for the other patch sets I have been playing
> > with related to TOAST.
> 
> This patch has been sitting on my desk for a couple of weeks now, and
> I am playing with varatt.h.  Any objections in getting rid of these
> struct markers at the end as of the patch posted upthread?

No objections here -- quite the contrary, especially because I also have
patches to do the same thing for other structs sitting around somewhere.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/



Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Tom Lane
Дата:
Michael Paquier <michael@paquier.xyz> writes:
> This patch has been sitting on my desk for a couple of weeks now, and
> I am playing with varatt.h.  Any objections in getting rid of these
> struct markers at the end as of the patch posted upthread?

+1 for concept.  Also, I did a bit of quick mechanical review
and found no problems:

1. I tried removing these struct tags altogether, ie

-typedef struct varlena
+typedef struct

It still compiles, proving that you found all the usages.
(I am *not* suggesting that you do that in the committed patch;
it'd break extensions to little purpose.)

2. I checked that pgindent is happy.

Looks ready to go to me, except the commit message needs work.

            regards, tom lane



Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

От
Michael Paquier
Дата:
On Tue, Feb 10, 2026 at 10:29:05AM -0500, Tom Lane wrote:
> -typedef struct varlena
> +typedef struct
>
> It still compiles, proving that you found all the usages.
> (I am *not* suggesting that you do that in the committed patch;
> it'd break extensions to little purpose.)

I didn't consider doing that to cross-check the change.  That's a good
one.

Applied that now, thanks all for the reviews.
--
Michael

Вложения