Re: trivial designated initializers
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Álvaro Herrera <alvherre@kurilemu.de>, Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-29T00:04:16Z
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())".
Commits
-
Use C99 designated designators in a couple of places
- 1eb09ed63a8d 19 (unreleased) landed