Skip to content

Commit

Permalink
Remove check for allowed table types
Browse files Browse the repository at this point in the history
We should now support all types with native postgres scan
  • Loading branch information
mkaruza committed Dec 23, 2024
1 parent fd16493 commit ebface1
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions src/pgduckdb_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ebface1

Please sign in to comment.