Skip to content

Commit

Permalink
support postgresql 15
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-XM-Zeng committed Sep 17, 2024
1 parent 66829fe commit 00eb688
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/pgduckdb_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ ContainsDuckdbFunctions(Node *node, void *context) {

if (IsA(node, Query)) {
Query *query = (Query *)node;
#if PG_VERSION_NUM >= 160000
return query_tree_walker(query, ContainsDuckdbFunctions, context, 0);
#else
return query_tree_walker(query, (bool (*)()) ((void *) ContainsDuckdbFunctions), context, 0);
#endif
#if PG_VERSION_NUM >= 160000
return query_tree_walker(query, ContainsDuckdbFunctions, context, 0);
#else
return query_tree_walker(query, (bool (*)()) ((void *) ContainsDuckdbFunctions), context, 0);
#endif
}

if (IsA(node, FuncExpr)) {
Expand All @@ -70,7 +70,7 @@ ContainsDuckdbFunctions(Node *node, void *context) {
return expression_tree_walker(node, ContainsDuckdbFunctions, context);
#else
return expression_tree_walker(node, (bool (*)()) ((void *) ContainsDuckdbFunctions), context);
#endif
#endif
}

static bool
Expand All @@ -79,7 +79,7 @@ NeedsDuckdbExecution(Query *query) {
return query_tree_walker(query, ContainsDuckdbFunctions, NULL, 0);
#else
return query_tree_walker(query, (bool (*)()) ((void *) ContainsDuckdbFunctions), NULL, 0);
#endif
#endif
}

static bool
Expand Down
2 changes: 1 addition & 1 deletion src/scan/postgres_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ PostgresReplacementScan(duckdb::ClientContext &context, duckdb::ReplacementScanI
}

/* SELECT query will have nodePath so we can return cardinality estimate of scan */
uint64_t nodeCardinality = node_path ? node_path->rows : 1;
Cardinality nodeCardinality = node_path ? node_path->rows : 1;

if ((node_path != nullptr && (node_path->pathtype == T_IndexScan || node_path->pathtype == T_IndexOnlyScan))) {
auto children = CreateFunctionIndexScanArguments(nodeCardinality, node_path, scan_data->m_query_planner_info,
Expand Down
7 changes: 1 addition & 6 deletions src/utility/copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ DuckdbCopy(PlannedStmt *pstmt, const char *query_string, struct QueryEnvironment
raw_stmt->stmt_location = pstmt->stmt_location;
raw_stmt->stmt_len = pstmt->stmt_len;

#if PG_VERSION_NUM >= 150000
rewritten = pg_analyze_and_rewrite_fixedparams(raw_stmt, query_string, NULL, 0, NULL);
#else
rewritten = pg_analyze_and_rewrite(raw_stmt, query_string, NULL, 0, NULL);
#endif

rewritten = pg_analyze_and_rewrite_fixedparams(raw_stmt, query_string, NULL, 0, NULL);
query = linitial_node(Query, rewritten);

/* Extract required vars for table */
Expand Down

0 comments on commit 00eb688

Please sign in to comment.