summaryrefslogtreecommitdiff
path: root/contrib/pgstattuple/pgstattuple.c
diff options
context:
space:
mode:
authorPeter Eisentraut2021-12-03 12:38:26 +0000
committerPeter Eisentraut2021-12-03 13:08:19 +0000
commit37b2764593c073ca61c2baebd7d85666e553928b (patch)
tree56de3f4f9040011f6dd6886adcb5b12a7ae692f8 /contrib/pgstattuple/pgstattuple.c
parent49422ad0cc88c91a38522b2a7b222c2f2c939f82 (diff)
Some RELKIND macro refactoring
Add more macros to group some RELKIND_* macros: - RELKIND_HAS_PARTITIONS() - RELKIND_HAS_TABLESPACE() - RELKIND_HAS_TABLE_AM() Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://www.postgresql.org/message-id/flat/a574c8f1-9c84-93ad-a9e5-65233d6fc00f%40enterprisedb.com
Diffstat (limited to 'contrib/pgstattuple/pgstattuple.c')
-rw-r--r--contrib/pgstattuple/pgstattuple.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c
index f408e6d84db..c9b8f01f9b4 100644
--- a/contrib/pgstattuple/pgstattuple.c
+++ b/contrib/pgstattuple/pgstattuple.c
@@ -252,14 +252,13 @@ pgstat_relation(Relation rel, FunctionCallInfo fcinfo)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot access temporary tables of other sessions")));
- switch (rel->rd_rel->relkind)
+ if (RELKIND_HAS_TABLE_AM(rel->rd_rel->relkind) ||
+ rel->rd_rel->relkind == RELKIND_SEQUENCE)
{
- case RELKIND_RELATION:
- case RELKIND_MATVIEW:
- case RELKIND_TOASTVALUE:
- case RELKIND_SEQUENCE:
return pgstat_heap(rel, fcinfo);
- case RELKIND_INDEX:
+ }
+ else if (rel->rd_rel->relkind == RELKIND_INDEX)
+ {
switch (rel->rd_rel->relam)
{
case BTREE_AM_OID:
@@ -288,9 +287,9 @@ pgstat_relation(Relation rel, FunctionCallInfo fcinfo)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("index \"%s\" (%s) is not supported",
RelationGetRelationName(rel), err)));
- break;
-
- default:
+ }
+ else
+ {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot get tuple-level statistics for relation \"%s\"",