Re: Use LOCKMODE in parse_relation.c/.h

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use LOCKMODE in parse_relation.c/.h
Date: 2026-02-18 17:19:57
Message-ID: 8c7a869d-c043-49ca-838f-c519df2e69bb@proxel.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2/18/26 10:50 AM, Peter Eisentraut wrote:
> There are a couple of comments in parse_relation.c
>
> > Note: properly, lockmode should be declared LOCKMODE not int, but that
> > would require importing storage/lock.h into parse_relation.h.  Since
> > LOCKMODE is typedef'd as int anyway, that seems like overkill.
>
> but actually LOCKMODE has been in storage/lockdefs.h for a while,
> which is intentionally a more narrow header.  So we can include that
> one in parse_relation.h and just use LOCKMODE normally.
>
> An alternative would be to add a duplicate typedef into
> parse_relation.h, but that doesn't seem necessary here.

Looks like a nice change and I did not find any more cases where we
should fix this.

But when I was looking I found a case where BufferLockMode could be used
in the gin code (ginStepRight() and the brin (brinGetTupleForHeapBlock)
code but I am not sure there are worth fixing.

Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2026-02-18 17:24:59 Re: DOCS - Add introductory paragraph to Getting Started chapter
Previous Message Zsolt Parragi 2026-02-18 16:58:58 Re: [OAuth2] Infrastructure for tracking token expiry time