Skip to content

Commit 2f5d1d2

Browse files
committed
Add compability with pg11
1 parent ca748bb commit 2f5d1d2

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

sr_plan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "commands/extension.h"
44
#include "catalog/pg_extension.h"
55
#include "catalog/indexing.h"
6-
#include "access/sysattr.h"
6+
#include "access/sysattr.h"
77
#include "access/xact.h"
88
#include "utils/lsyscache.h"
99

@@ -406,7 +406,7 @@ PG_FUNCTION_INFO_V1(explain_jsonb_plan);
406406
Datum
407407
explain_jsonb_plan(PG_FUNCTION_ARGS)
408408
{
409-
Jsonb *jsonb_plan = PG_GETARG_JSONB(0);
409+
Jsonb *jsonb_plan = PG_GETARG_JSONB_P(0);
410410
Node *plan;
411411

412412
if (jsonb_plan == NULL)
@@ -511,7 +511,7 @@ sr_plan_invalid_table(PG_FUNCTION_ARGS)
511511
if (fcinfo_new.isnull)
512512
elog(ERROR, "function %p returned NULL", (void *) pg_event_trigger_dropped_objects);
513513

514-
slot = MakeTupleTableSlot();
514+
slot = MakeTupleTableSlotCompat();
515515
ExecSetSlotDescriptor(slot, rsinfo.setDesc);
516516

517517
while(tuplestore_gettupleslot(rsinfo.setResult, true,

sr_plan.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,23 @@ Jsonb *node_tree_to_jsonb(const void *obj, Oid fake_func, bool skip_location_fro
3737
void *jsonb_to_node_tree(Jsonb *json, void *(*hookPtr) (void *));
3838
void common_walker(const void *obj, void (*callback) (void *));
3939

40+
/*
41+
* MakeTupleTableSlot()
42+
*/
43+
#if PG_VERSION_NUM >= 110000
44+
#define MakeTupleTableSlotCompat() \
45+
MakeTupleTableSlot(NULL)
46+
#else
47+
#define MakeTupleTableSlotCompat() \
48+
MakeTupleTableSlot()
49+
#endif
50+
51+
#ifndef PG_GETARG_JSONB_P
52+
#define PG_GETARG_JSONB_P(x) PG_GETARG_JSONB(x)
53+
#endif
54+
55+
#ifndef PG_RETURN_JSONB_P
56+
#define PG_RETURN_JSONB_P(x) PG_RETURN_JSONB(x)
57+
#endif
58+
4059
#endif

0 commit comments

Comments
 (0)