Re: Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2024-07-01T08:01:46Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add assertions that we hold some relevant lock during relation open.

On Mon, Jul 01, 2024 at 06:42:46AM +0000, Bertrand Drouvot wrote:
> While working on a rebase for [1] due to 0cecc908e97, I noticed that
> CheckRelationLockedByMe() and CheckRelationOidLockedByMe() are used only in
> assertions.
> 
> I think it would make sense to declare / define those functions only for
> assert enabled build: please find attached a tiny patch doing so.
> 
> Thoughts?

Not convinced that's a good idea.  What about out-of-core code that
may use these routines for runtime checks in non-assert builds?
--
Michael