| Lists: | pgsql-hackers |
|---|
| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-01-20 07:41:49 |
| Message-ID: | aW8xvVbovdhyI4yo@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Remove-varlena-structs.patch | text/x-diff | 54.8 KB |
| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 05:12:28 |
| Message-ID: | aYq-PJrUBIvJx7JD@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
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
| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 08:13:34 |
| Message-ID: | E05F202B-9F05-4F86-9880-0EECE6F62943@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
> On Feb 10, 2026, at 13:12, Michael Paquier <michael(at)paquier(dot)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/
| From: | Shinya Kato <shinya11(dot)kato(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 09:03:09 |
| Message-ID: | CAOzEurRgrU8ejE5Y2sJT8kTD=GXpHXOVAQA5R=Fz6iGRiD=X1g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Tue, Feb 10, 2026 at 2:12 PM Michael Paquier <michael(at)paquier(dot)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
| From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 09:35:14 |
| Message-ID: | edbe730e-f6b8-42cd-9906-bb3dda970772@proxel.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
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
| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 10:07:48 |
| Message-ID: | 202602101006.dioy3bgeahhb@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
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/
| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 15:29:05 |
| Message-ID: | 3801860.1770737345@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Michael Paquier <michael(at)paquier(dot)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
| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Remove "struct" markers from varlena, varatt_external and varatt_indirect |
| Date: | 2026-02-10 22:36:16 |
| Message-ID: | aYuy4JV86GvWzCS5@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
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