Remove "struct" markers from varlena, varatt_external and varatt_indirect

Started by Michael Paquier3 months ago8 messageshackers
Jump to latest
#1Michael Paquier
michael@paquier.xyz

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):
/messages/by-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

Attachments:

0001-Remove-varlena-structs.patchtext/x-diff; charset=us-asciiDownload+212-210
#2Michael Paquier
michael@paquier.xyz
In reply to: Michael Paquier (#1)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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

#3Chao Li
li.evan.chao@gmail.com
In reply to: Michael Paquier (#2)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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 it locally and ran “make check”, everything passed.

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

#4Shinya Kato
shinya11.kato@gmail.com
In reply to: Michael Paquier (#2)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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

#5Andreas Karlsson
andreas.karlsson@percona.com
In reply to: Michael Paquier (#1)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Michael Paquier (#2)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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/

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#2)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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

#8Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#7)
Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect

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