33#define JsonbContainsStrategyNumber 7
34#define JsonbExistsStrategyNumber 9
35#define JsonbExistsAnyStrategyNumber 10
36#define JsonbExistsAllStrategyNumber 11
37#define JsonbJsonpathExistsStrategyNumber 15
38#define JsonbJsonpathPredicateStrategyNumber 16
62#define JGINFLAG_KEY 0x01
63#define JGINFLAG_NULL 0x02
64#define JGINFLAG_BOOL 0x03
65#define JGINFLAG_NUM 0x04
66#define JGINFLAG_STR 0x05
67#define JGINFLAG_HASHED 0x10
68#define JGIN_MAXLENGTH 125
138#define JENTRY_OFFLENMASK 0x0FFFFFFF
139#define JENTRY_TYPEMASK 0x70000000
140#define JENTRY_HAS_OFF 0x80000000
143#define JENTRY_ISSTRING 0x00000000
144#define JENTRY_ISNUMERIC 0x10000000
145#define JENTRY_ISBOOL_FALSE 0x20000000
146#define JENTRY_ISBOOL_TRUE 0x30000000
147#define JENTRY_ISNULL 0x40000000
148#define JENTRY_ISCONTAINER 0x50000000
151#define JBE_OFFLENFLD(je_) ((je_) & JENTRY_OFFLENMASK)
152#define JBE_HAS_OFF(je_) (((je_) & JENTRY_HAS_OFF) != 0)
153#define JBE_ISSTRING(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISSTRING)
154#define JBE_ISNUMERIC(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNUMERIC)
155#define JBE_ISCONTAINER(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISCONTAINER)
156#define JBE_ISNULL(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNULL)
157#define JBE_ISBOOL_TRUE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_TRUE)
158#define JBE_ISBOOL_FALSE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_FALSE)
159#define JBE_ISBOOL(je_) (JBE_ISBOOL_TRUE(je_) || JBE_ISBOOL_FALSE(je_))
162#define JBE_ADVANCE_OFFSET(offset, je) \
165 if (JBE_HAS_OFF(je_)) \
166 (offset) = JBE_OFFLENFLD(je_); \
168 (offset) += JBE_OFFLENFLD(je_); \
178#define JB_OFFSET_STRIDE 32
200#define JB_CMASK 0x0FFFFFFF
201#define JB_FSCALAR 0x10000000
202#define JB_FOBJECT 0x20000000
203#define JB_FARRAY 0x40000000
206#define JsonContainerSize(jc) ((jc)->header & JB_CMASK)
207#define JsonContainerIsScalar(jc) (((jc)->header & JB_FSCALAR) != 0)
208#define JsonContainerIsObject(jc) (((jc)->header & JB_FOBJECT) != 0)
209#define JsonContainerIsArray(jc) (((jc)->header & JB_FARRAY) != 0)
219#define JB_ROOT_COUNT(jbp_) (*(uint32 *) VARDATA(jbp_) & JB_CMASK)
220#define JB_ROOT_IS_SCALAR(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FSCALAR) != 0)
221#define JB_ROOT_IS_OBJECT(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FOBJECT) != 0)
222#define JB_ROOT_IS_ARRAY(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FARRAY) != 0)
297#define IsAJsonbScalar(jsonbval) (((jsonbval)->type >= jbvNull && \
298 (jsonbval)->type <= jbvBool) || \
299 (jsonbval)->type == jbvDatetime)
391#define PG_GETARG_JSONB_P(x) DatumGetJsonbP(PG_GETARG_DATUM(x))
392#define PG_GETARG_JSONB_P_COPY(x) DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
393#define PG_RETURN_JSONB_P(x) PG_RETURN_POINTER(x)
403 const char *keyVal,
int keyLen,
432 bool *isnull,
bool as_text);
435 const Oid *
types,
bool absent_on_null,
438 const Oid *
types,
bool absent_on_null);
#define FLEXIBLE_ARRAY_MEMBER
#define PG_DETOAST_DATUM_COPY(datum)
#define PG_DETOAST_DATUM(datum)
static Jsonb * DatumGetJsonbPCopy(Datum d)
char * JsonbUnquote(Jsonb *jb)
Datum jsonb_build_array_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types, bool absent_on_null)
static Datum JsonbPGetDatum(const Jsonb *p)
struct JsonbParseState JsonbParseState
Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, JsonbValue *newval)
JsonbValue * getKeyJsonValueFromContainer(JsonbContainer *container, const char *keyVal, int keyLen, JsonbValue *res)
int compareJsonbContainers(JsonbContainer *a, JsonbContainer *b)
Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, bool *isnull, bool as_text)
uint32 getJsonbLength(const JsonbContainer *jc, int index)
char * JsonbToCString(StringInfo out, JsonbContainer *in, int estimated_len)
JsonbValue * pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq, JsonbValue *jbval)
JsonbIterator * JsonbIteratorInit(JsonbContainer *container)
const char * JsonbTypeName(JsonbValue *val)
static Jsonb * DatumGetJsonbP(Datum d)
void JsonbHashScalarValue(const JsonbValue *scalarVal, uint32 *hash)
Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types, bool absent_on_null, bool unique_keys)
void JsonbToJsonbValue(Jsonb *jsonb, JsonbValue *val)
JsonbValue * findJsonbValueFromContainer(JsonbContainer *container, uint32 flags, JsonbValue *key)
JsonbIteratorToken JsonbIteratorNext(JsonbIterator **it, JsonbValue *val, bool skipNested)
struct JsonbIterator JsonbIterator
uint32 getJsonbOffset(const JsonbContainer *jc, int index)
bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res)
void JsonbHashScalarValueExtended(const JsonbValue *scalarVal, uint64 *hash, uint64 seed)
JsonbValue * getIthJsonbValueFromContainer(JsonbContainer *container, uint32 i)
Jsonb * JsonbValueToJsonb(JsonbValue *val)
char * JsonbToCStringIndent(StringInfo out, JsonbContainer *in, int estimated_len)
bool JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained)
bool to_jsonb_is_immutable(Oid typoid)
struct JsonbContainer JsonbContainer
static Datum PointerGetDatum(const void *X)
static unsigned hash(unsigned *uv, int n)
JEntry children[FLEXIBLE_ARRAY_MEMBER]
struct JsonbIterator * parent
JsonbContainer * container
struct JsonbParseState * next
struct JsonbValue::@141::@144 object
struct JsonbValue::@141::@143 array
struct JsonbValue::@141::@145 binary
struct JsonbValue::@141::@146 datetime
struct JsonbValue::@141::@142 string