Skip to content

Commit

Permalink
Check if catalog table is in RTE_SUBQUERY
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaruza committed May 13, 2024
1 parent 9e092f5 commit c40d805
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/quack_heap_seq_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ extern "C" {
#include <thread>

namespace quack {

PostgresHeapSeqScan::PostgresHeapSeqScan(RangeTblEntry *table)
: m_tableEntry(table), m_rel(nullptr), m_snapshot(nullptr) {
}
Expand Down
6 changes: 6 additions & 0 deletions src/quack_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ is_catalog_table(List *tables) {
ListCell *lc;
foreach (lc, tables) {
RangeTblEntry *table = (RangeTblEntry *)lfirst(lc);
if (table->rtekind == RTE_SUBQUERY) {
/* Check Subquery rtable list if any table is from PG catalog */
if (is_catalog_table(table->subquery->rtable)) {
return true;
};
}
if (table->relid) {
auto rel = RelationIdGetRelation(table->relid);
auto namespaceOid = RelationGetNamespace(rel);
Expand Down
6 changes: 3 additions & 3 deletions src/quack_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ extern "C" {

namespace quack {

static duckdb::DuckDB *
static duckdb::unique_ptr<duckdb::DuckDB>
quack_open_database() {
duckdb::DBConfig config;
// config.SetOption("memory_limit", "2GB");
// config.SetOption("threads", "8");
// config.allocator = duckdb::make_uniq<duckdb::Allocator>(QuackAllocate, QuackFree, QuackReallocate, nullptr);
return new duckdb::DuckDB(nullptr, &config);
return duckdb::make_uniq<duckdb::DuckDB>(nullptr, &config);
}

} // namespace quack
Expand Down Expand Up @@ -82,7 +82,7 @@ quack_create_plan(Query *parse, const char *query) {
}
}

quackNode->custom_private = list_make2(db, preparedQuery.release());
quackNode->custom_private = list_make2(db.release(), preparedQuery.release());
quackNode->methods = &quack_scan_scan_methods;

return (Plan *)quackNode;
Expand Down

0 comments on commit c40d805

Please sign in to comment.