Re: Use LOCKMODE in parse_relation.c/.h

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use LOCKMODE in parse_relation.c/.h
Date: 2026-02-19 09:03:53
Message-ID: CAExHW5uK907BZ6ZsWURBH86oAgSDStgjEXfqLwd3qSS3rBDkTA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 18, 2026 at 3:20 PM Peter Eisentraut <peter(at)eisentraut(dot)org> 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.

lockdefs.h is much younger (4eda0a64705763854225a29703b606692af50e77)
than the comment (b153c0920960a6059b67969469166fb29c0105d7) mentioned
above. The commit changed some #include "lock.h" to use lockdefs.h. I
guess it didn't notice that parse_relation.h can use it because it
didn't include lock.h and didn't define LOCKMODE. The change looks
good to me.

>
> An alternative would be to add a duplicate typedef into
> parse_relation.h, but that doesn't seem necessary here.

Not needed.

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-02-19 09:21:27 Re: Eliminating SPI / SQL from some RI triggers - take 3
Previous Message Nazir Bilal Yavuz 2026-02-19 09:01:02 Re: Speed up COPY FROM text/CSV parsing using SIMD