Skip to content

Commit 6bb9f52

Browse files
committed
Build cleanly back to 9.6
1 parent 6ee08a9 commit 6bb9f52

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

http.c

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@
4545
#include <funcapi.h>
4646
#include <access/genam.h>
4747
#include <access/htup.h>
48-
#include <access/table.h>
48+
#include <access/sysattr.h>
4949
#include <catalog/namespace.h>
5050
#include <catalog/pg_type.h>
5151
#include <catalog/pg_extension.h>
5252
#include <catalog/dependency.h>
53+
#include <catalog/indexing.h>
5354
#include <commands/extension.h>
5455
#include <lib/stringinfo.h>
5556
#include <mb/pg_wchar.h>
@@ -64,12 +65,23 @@
6465
#include <utils/fmgroids.h>
6566
#include <utils/guc.h>
6667

68+
#if PG_VERSION_NUM >= 90300
69+
# include <access/htup_details.h>
70+
#endif
71+
6772
#if PG_VERSION_NUM >= 100000
68-
#include <utils/varlena.h>
73+
# include <utils/varlena.h>
6974
#endif
7075

71-
#if PG_VERSION_NUM >= 90300
72-
#include <access/htup_details.h>
76+
#if PG_VERSION_NUM >= 120000
77+
# include <access/table.h>
78+
#else
79+
# define table_open(rel, lock) heap_open((rel), (lock))
80+
# define table_close(rel, lock) heap_close((rel), (lock))
81+
#endif
82+
83+
#ifndef PG_GETARG_JSONB_P
84+
#define PG_GETARG_JSONB_P(x) DatumGetJsonb(PG_GETARG_DATUM(x))
7385
#endif
7486

7587
/* CURL */
@@ -589,11 +601,15 @@ get_extension_schema(Oid ext_oid)
589601
SysScanDesc scandesc;
590602
HeapTuple tuple;
591603
ScanKeyData entry[1];
592-
593604
rel = table_open(ExtensionRelationId, AccessShareLock);
605+
#if PG_VERSION_NUM >= 120000
606+
Oid pg_extension_oid = Anum_pg_extension_oid;
607+
#else
608+
Oid pg_extension_oid = ObjectIdAttributeNumber;
609+
#endif
594610

595611
ScanKeyInit(&entry[0],
596-
Anum_pg_extension_oid,
612+
pg_extension_oid,
597613
BTEqualStrategyNumber, F_OIDEQ,
598614
ObjectIdGetDatum(ext_oid));
599615

@@ -1495,8 +1511,19 @@ Datum urlencode_jsonb(PG_FUNCTION_ARGS)
14951511
key = pnstrdup(v.val.string.val, v.val.string.len);
14961512
key_enc = urlencode_cstr(v.val.string.val, v.val.string.len);
14971513

1498-
/* Read and encode the value */
1514+
/* Read the value for this key */
1515+
#if PG_VERSION_NUM < 130000
1516+
{
1517+
JsonbValue k;
1518+
k.type = jbvString;
1519+
k.val.string.val = key;
1520+
k.val.string.len = strlen(key);
1521+
v = *findJsonbValueFromContainer(&jb->root, JB_FOBJECT, &k);
1522+
}
1523+
#else
14991524
getKeyJsonValueFromContainer(&jb->root, key, strlen(key), &v);
1525+
#endif
1526+
/* Read and encode the value */
15001527
switch(v.type)
15011528
{
15021529
case jbvString: {

0 commit comments

Comments
 (0)