Skip to content

Commit

Permalink
Fix PG <15
Browse files Browse the repository at this point in the history
  • Loading branch information
mkgrgis committed Dec 27, 2024
1 parent 2071fc1 commit 14ce43b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sqlite_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,6 @@ sqliteGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid,
#if PG_VERSION_NUM >= 150000
has_final_sort = boolVal(list_nth(best_path->fdw_private, FdwPathPrivateHasFinalSort));
has_limit = boolVal(list_nth(best_path->fdw_private, FdwPathPrivateHasLimit));

#else
has_final_sort = intVal(list_nth(best_path->fdw_private, FdwPathPrivateHasFinalSort));
has_limit = intVal(list_nth(best_path->fdw_private, FdwPathPrivateHasLimit));
Expand Down Expand Up @@ -1886,7 +1885,11 @@ sqliteBeginForeignModify(ModifyTableState *mtstate,
fmstate->conn = sqlite_get_connection(fmstate->server, false);
fmstate->query = strVal(list_nth(fdw_private, FdwModifyPrivateUpdateSql));
fmstate->target_attrs = (List *) list_nth(fdw_private, FdwModifyPrivateTargetAttnums);
#if PG_VERSION_NUM >= 150000
fmstate->has_returning = boolVal(list_nth(fdw_private, FdwModifyPrivateHasReturning));
#else
fmstate->has_returning = intVal(list_nth(fdw_private, FdwModifyPrivateHasReturning));
#endif
fmstate->retrieved_attrs = (List *) list_nth(fdw_private, FdwModifyPrivateTargetAttnums);
fmstate->values_end = intVal(list_nth(fdw_private, FdwModifyPrivateLen));
fmstate->orig_query = pstrdup(fmstate->query);
Expand Down Expand Up @@ -2556,12 +2559,14 @@ sqlitePlanDirectModify(PlannerInfo *root,
rebuild_fdw_scan_tlist(fscan, returningList);
}

#if PG_VERSION_NUM >= 150000
/*
* Finally, unset the async-capable flag if it is set, as we currently
* don't support asynchronous execution of direct modifications.
*/
if (fscan->scan.plan.async_capable)
fscan->scan.plan.async_capable = false;
#endif

table_close(rel, NoLock);
return true;
Expand Down

0 comments on commit 14ce43b

Please sign in to comment.