From 13026108a6ce5a634806646732f06ad121f475b9 Mon Sep 17 00:00:00 2001 From: Yves Date: Wed, 18 Dec 2024 14:43:20 +0100 Subject: [PATCH] Vendor `RELKIND_HAS_TABLE_AM` for PG14 --- src/pg/relations.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pg/relations.cpp b/src/pg/relations.cpp index dbc10d04..a0279435 100644 --- a/src/pg/relations.cpp +++ b/src/pg/relations.cpp @@ -17,6 +17,20 @@ namespace pgduckdb { #undef RelationGetDescr +#if PG_VERSION_NUM < 150000 +/* + * Relation kinds with a table access method (rd_tableam). Although sequences + * use the heap table AM, they are enough of a special case in most uses that + * they are not included here. Likewise, partitioned tables can have an access + * method defined so that their partitions can inherit it, but they do not set + * rd_tableam; hence, this is handled specially outside of this macro. + */ +#define RELKIND_HAS_TABLE_AM(relkind) \ + ((relkind) == RELKIND_RELATION || \ + (relkind) == RELKIND_TOASTVALUE || \ + (relkind) == RELKIND_MATVIEW) +#endif + TupleDesc RelationGetDescr(Relation rel) { return rel->rd_att;