1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Support amcheck of sequences

Sequences were left out of the list of relation kinds that
verify_heapam knew how to check, though it is fairly trivial to allow
them.  Doing that, and while at it, updating pg_amcheck to include
sequences in relations matched by table and relation patterns.

Author: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/81ad4757-92c1-4aa3-7bee-f609544837e3%40enterprisedb.com
This commit is contained in:
Peter Eisentraut
2021-09-28 15:26:25 +02:00
parent 7d1aa6bf1c
commit c3b011d991
6 changed files with 95 additions and 18 deletions

View File

@ -305,14 +305,20 @@ verify_heapam(PG_FUNCTION_ARGS)
*/
if (ctx.rel->rd_rel->relkind != RELKIND_RELATION &&
ctx.rel->rd_rel->relkind != RELKIND_MATVIEW &&
ctx.rel->rd_rel->relkind != RELKIND_TOASTVALUE)
ctx.rel->rd_rel->relkind != RELKIND_TOASTVALUE &&
ctx.rel->rd_rel->relkind != RELKIND_SEQUENCE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot check relation \"%s\"",
RelationGetRelationName(ctx.rel)),
errdetail_relkind_not_supported(ctx.rel->rd_rel->relkind)));
if (ctx.rel->rd_rel->relam != HEAP_TABLE_AM_OID)
/*
* Sequences always use heap AM, but they don't show that in the catalogs.
* Other relkinds might be using a different AM, so check.
*/
if (ctx.rel->rd_rel->relkind != RELKIND_SEQUENCE &&
ctx.rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));