Skip to content

Commit 0e25dd1

Browse files
committed
Improve support of PostgreSQL 12
1 parent 8f62247 commit 0e25dd1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pg_variables.c

+14
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ static void initObjectHistory(TransObject *object, TransObjectType type);
8686
/* Hook functions */
8787
static void variable_ExecutorEnd(QueryDesc *queryDesc);
8888

89+
#if PG_VERSION_NUM >= 120000
90+
#define CHECK_ARGS_FOR_NULL() \
91+
do { \
92+
if (fcinfo->args[0].isnull) \
93+
ereport(ERROR, \
94+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
95+
errmsg("package name can not be NULL"))); \
96+
if (fcinfo->args[1].isnull) \
97+
ereport(ERROR, \
98+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
99+
errmsg("variable name can not be NULL"))); \
100+
} while(0)
101+
#else /* PG_VERSION_NUM < 120000 */
89102
#define CHECK_ARGS_FOR_NULL() \
90103
do { \
91104
if (fcinfo->argnull[0]) \
@@ -97,6 +110,7 @@ do { \
97110
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
98111
errmsg("variable name can not be NULL"))); \
99112
} while(0)
113+
#endif /* PG_VERSION_NUM */
100114

101115
static HTAB *packagesHash = NULL;
102116
static MemoryContext ModuleContext = NULL;

pg_variables_record.c

+2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ init_record(RecordVar *record, TupleDesc tupdesc, Variable *variable)
137137

138138
oldcxt = MemoryContextSwitchTo(record->hctx);
139139
record->tupdesc = CreateTupleDescCopy(tupdesc);
140+
#if PG_VERSION_NUM < 120000
140141
record->tupdesc->tdhasoid = false;
142+
#endif
141143
record->tupdesc->tdtypeid = RECORDOID;
142144
record->tupdesc->tdtypmod = -1;
143145
record->tupdesc = BlessTupleDesc(record->tupdesc);

0 commit comments

Comments
 (0)