Re: trivial designated initializers

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: trivial designated initializers
Date: 2026-01-29 00:04:16
Message-ID: a44072f3-15d8-4118-b6cb-0345b30ca3eb@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28.01.26 13:20, Álvaro Herrera wrote:
> { /* LockTupleKeyShare */
> - AccessShareLock,
> - MultiXactStatusForKeyShare,
> - -1 /* KeyShare does not allow updating tuples */
> + .hwlock = AccessShareLock,
> + .lockstatus = MultiXactStatusForKeyShare,
> + /* KeyShare does not allow updating tuples */
> + .updstatus = -1
> },

You could spruce this up further like

[LockTupleKeyShare] = {
.hwlock = AccessShareLock,
...
},
...

The comments "/* KeyShare does not allow updating tuples */" etc. seem
repetitive and don't actually explain why -1 is an appropriate value.
You could instead write a comment by the declaration of the updstatus
field, like "set to -1 if the tuple lock mode does not allow updating
tuples (see get_mxact_status_for_lock())".

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-01-29 00:22:20 Re: Correction to comment of brin_range_deserialize
Previous Message David G. Johnston 2026-01-28 23:48:41 Docs: Use non-default throughout the documentation