pgsql: Flip logic in table validate_relation_kind

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Flip logic in table validate_relation_kind
Date: 2026-02-23 16:32:35
Message-ID: E1vuYrL-000qlu-2p@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Flip logic in table validate_relation_kind

It instead of checking which relkinds it shouldn't be, explicitly list
the ones we accept. This is used to check which relkinds are accepted
in table_open() and related functions. Before this change, figuring
that out was always a few steps too complicated. This also makes
changes for new relkinds more explicit instead of accidental.
Finally, this makes this more aligned with the functions of the same
name in src/backend/access/index/indexam.c and
src/backend/access/sequence/sequence.c.

Reviewed-by: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Reviewed-by: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d7be57ad85da54bf3c7e079e4941935e5d00fdf2

Modified Files
--------------
src/backend/access/table/table.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-02-23 16:43:30 pgsql: Rename validate_relation_kind()
Previous Message Andrew Dunstan 2026-02-23 16:20:21 pgsql: Disallow CR and LF in database, role, and tablespace names