Skip to content

Commit

Permalink
write compat for create_foreignscan_path bcs of more arguments in PG17
Browse files Browse the repository at this point in the history
Relevant PG commit:
9e9931d2bf40e2fea447d779c2e133c2c1256ef3
postgres/postgres@9e9931d
  • Loading branch information
naisila committed Jul 25, 2024
1 parent 651bcc7 commit ec9beb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/backend/distributed/test/fake_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "optimizer/restrictinfo.h"
#include "utils/palloc.h"

#include "pg_version_constants.h"
#include "pg_version_compat.h"

/* local function forward declarations */
static void FakeGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel,
Expand Down Expand Up @@ -91,9 +91,11 @@ FakeGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid)
Cost startup_cost = 0;
Cost total_cost = startup_cost + baserel->rows;

add_path(baserel, (Path *) create_foreignscan_path(root, baserel, NULL, baserel->rows,
startup_cost, total_cost, NIL,
NULL, NULL, NIL));
add_path(baserel, (Path *) create_foreignscan_path_compat(root, baserel, NULL,
baserel->rows,
startup_cost, total_cost,
NIL,
NULL, NULL, NIL, NIL));
}


Expand Down
8 changes: 8 additions & 0 deletions src/include/pg_version_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ getStxstattarget_compat(HeapTuple tup)

#define matched_compat(a) (a->matchKind == MERGE_WHEN_MATCHED)

#define create_foreignscan_path_compat(a, b, c, d, e, f, g, h, i, j, \
k) create_foreignscan_path(a, b, c, d, e, f, g, h, \
i, j, k)

#else

#include "access/htup_details.h"
Expand Down Expand Up @@ -131,6 +135,10 @@ getStxstattarget_compat(HeapTuple tup)

#define matched_compat(a) (a->matched)

#define create_foreignscan_path_compat(a, b, c, d, e, f, g, h, i, j, \
k) create_foreignscan_path(a, b, c, d, e, f, g, h, \
i, k)

#endif

#if PG_VERSION_NUM >= PG_VERSION_16
Expand Down

0 comments on commit ec9beb5

Please sign in to comment.