From ebface18bd083ba2d12717d78b635ca975111fc4 Mon Sep 17 00:00:00 2001 From: mkaruza Date: Mon, 23 Dec 2024 10:21:34 +0100 Subject: [PATCH] Remove check for allowed table types We should now support all types with native postgres scan --- src/pgduckdb_hooks.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/pgduckdb_hooks.cpp b/src/pgduckdb_hooks.cpp index 46f2bf5d..92a6801c 100644 --- a/src/pgduckdb_hooks.cpp +++ b/src/pgduckdb_hooks.cpp @@ -60,39 +60,6 @@ ContainsCatalogTable(List *rtes) { return false; } -static bool -ContainsAllowedTableType(List *rtes, int elevel) { - foreach_node(RangeTblEntry, rte, rtes) { - if (rte->rtekind == RTE_SUBQUERY) { - /* Check whether any table in the subquery is a partitioned table */ - if (ContainsAllowedTableType(rte->subquery->rtable, elevel)) { - return true; - } - } - - /* Allow functions */ - if (rte->rtekind == RTE_FUNCTION) { - return true; - } - - switch (rte->relkind) { - case RELKIND_RELATION: - case RELKIND_INDEX: - case RELKIND_TOASTVALUE: - case RELKIND_VIEW: - case RELKIND_MATVIEW: - case RELKIND_FOREIGN_TABLE: - case RELKIND_PARTITIONED_TABLE: - case RELKIND_PARTITIONED_INDEX: - return true; - default: - elog(elevel, "DuckDB does not support querying table type '%c'", rte->relkind); - return false; - } - } - return false; -} - static bool IsDuckdbTable(Oid relid) { if (relid == InvalidOid) { @@ -194,14 +161,6 @@ IsAllowedStatement(Query *query, bool throw_error = false) { return false; } - /* - * Check that we're only accessing table types that we know we have support - * for. - */ - if (!ContainsAllowedTableType(query->rtable, elevel)) { - return false; - } - /* Anything else is hopefully fine... */ return true; }