Introduce sequence_*() access functions
authorMichael Paquier
Mon, 26 Feb 2024 07:04:59 +0000 (16:04 +0900)
committerMichael Paquier
Mon, 26 Feb 2024 07:04:59 +0000 (16:04 +0900)
commit449e798c77ed9a03f8bb04e5d324d4e3cfbbae8e
tree91f643e47147d44a95fc707908549de2d539eb5d
parent025f0a6f9113efe89bb65b9efe0cb96a5d7c7ad1
Introduce sequence_*() access functions

Similarly to tables and indexes, these functions are able to open
relations with a sequence relkind, which is useful to make a distinction
with the other relation kinds.  Previously, commands/sequence.c used a
mix of table_{close,open}() and relation_{close,open}() routines when
manipulating sequence relations, so this clarifies the code.

A direct effect of this change is to align the error messages produced
when attempting DDLs for sequences on relations with an unexpected
relkind, like a table or an index with ALTER SEQUENCE, providing an
extra error detail about the relkind of the relation used in the DDL
query.

Author: Michael Paquier
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/[email protected]
src/backend/access/Makefile
src/backend/access/meson.build
src/backend/access/sequence/Makefile [new file with mode: 0644]
src/backend/access/sequence/meson.build [new file with mode: 0644]
src/backend/access/sequence/sequence.c [new file with mode: 0644]
src/backend/commands/sequence.c
src/include/access/sequence.h [new file with mode: 0644]
src/test/regress/expected/sequence.out