Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix PG16 compatibility #105

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void * exc_palloc(Size size)
void * ret;
MemoryContext context = CurrentMemoryContext;

AssertArg(MemoryContextIsValid(context));
Assert(MemoryContextIsValid(context));

if (!AllocSizeIsValid(size))
throw std::bad_alloc();
Expand All @@ -80,7 +80,7 @@ void * exc_palloc0(Size size)
void * ret;
MemoryContext context = CurrentMemoryContext;

AssertArg(MemoryContextIsValid(context));
Assert(MemoryContextIsValid(context));

if (!AllocSizeIsValid(size))
throw std::bad_alloc();
Expand Down
11 changes: 11 additions & 0 deletions src/clickhouse_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,11 @@ clickhouseBeginForeignScan(ForeignScanState *node, int eflags)
else
rtindex = bms_next_member(fsplan->fs_relids, -1);
rte = rt_fetch(rtindex, estate->es_range_table);
#if PG_VERSION_NUM >= 160000
userid = OidIsValid(fsplan->checkAsUser) ? fsplan->checkAsUser : GetUserId();
#else
userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
#endif

/* Get info about foreign table. */
table = GetForeignTable(rte->relid);
Expand Down Expand Up @@ -1377,7 +1381,11 @@ create_foreign_modify(EState *estate,
* Identify which user to do the remote access as. This should match what
* ExecCheckRTEPerms() does.
*/
#if PG_VERSION_NUM >= 160000
userid = ExecGetResultRelCheckAsUser(rri, estate);
#else
userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
#endif

/* Get info about foreign table. */
table = GetForeignTable(RelationGetRelid(rel));
Expand Down Expand Up @@ -2171,6 +2179,9 @@ foreign_grouping_ok(PlannerInfo *root, RelOptInfo *grouped_rel,
expr,
true,
false,
#if PG_VERSION_NUM >= 160000
false,
#endif
false,
root->qual_security_level,
grouped_rel->relids,
Expand Down
Loading