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
140#define JENTRY_OFFLENMASK 0x0FFFFFFF
141#define JENTRY_TYPEMASK 0x70000000
142#define JENTRY_HAS_OFF 0x80000000
145#define JENTRY_ISSTRING 0x00000000
146#define JENTRY_ISNUMERIC 0x10000000
147#define JENTRY_ISBOOL_FALSE 0x20000000
148#define JENTRY_ISBOOL_TRUE 0x30000000
149#define JENTRY_ISNULL 0x40000000
150#define JENTRY_ISCONTAINER 0x50000000
153#define JBE_OFFLENFLD(je_) ((je_) & JENTRY_OFFLENMASK)
154#define JBE_HAS_OFF(je_) (((je_) & JENTRY_HAS_OFF) != 0)
155#define JBE_ISSTRING(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISSTRING)
156#define JBE_ISNUMERIC(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNUMERIC)
157#define JBE_ISCONTAINER(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISCONTAINER)
158#define JBE_ISNULL(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNULL)
159#define JBE_ISBOOL_TRUE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_TRUE)
160#define JBE_ISBOOL_FALSE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_FALSE)
161#define JBE_ISBOOL(je_) (JBE_ISBOOL_TRUE(je_) || JBE_ISBOOL_FALSE(je_))
164#define JBE_ADVANCE_OFFSET(offset, je) \
167 if (JBE_HAS_OFF(je_)) \
168 (offset) = JBE_OFFLENFLD(je_); \
170 (offset) += JBE_OFFLENFLD(je_); \
180#define JB_OFFSET_STRIDE 32
202#define JB_CMASK 0x0FFFFFFF
203#define JB_FSCALAR 0x10000000
204#define JB_FOBJECT 0x20000000
205#define JB_FARRAY 0x40000000
208#define JsonContainerSize(jc) ((jc)->header & JB_CMASK)
209#define JsonContainerIsScalar(jc) (((jc)->header & JB_FSCALAR) != 0)
210#define JsonContainerIsObject(jc) (((jc)->header & JB_FOBJECT) != 0)
211#define JsonContainerIsArray(jc) (((jc)->header & JB_FARRAY) != 0)
221#define JB_ROOT_COUNT(jbp_) (*(uint32 *) VARDATA(jbp_) & JB_CMASK)
222#define JB_ROOT_IS_SCALAR(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FSCALAR) != 0)
223#define JB_ROOT_IS_OBJECT(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FOBJECT) != 0)
224#define JB_ROOT_IS_ARRAY(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FARRAY) != 0)
299#define IsAJsonbScalar(jsonbval) (((jsonbval)->type >= jbvNull && \
300 (jsonbval)->type <= jbvBool) || \
301 (jsonbval)->type == jbvDatetime)
418#define PG_GETARG_JSONB_P(x) DatumGetJsonbP(PG_GETARG_DATUM(x))
419#define PG_GETARG_JSONB_P_COPY(x) DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
420#define PG_RETURN_JSONB_P(x) PG_RETURN_POINTER(x)
430 const char *keyVal,
int keyLen,
459 bool *isnull,
bool as_text);
462 const Oid *
types,
bool absent_on_null,
465 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)
void pushJsonbValue(JsonbInState *pstate, JsonbIteratorToken seq, JsonbValue *jbval)
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)
JsonbValue * getKeyJsonValueFromContainer(JsonbContainer *container, const char *keyVal, int keyLen, JsonbValue *res)
Datum jsonb_set_element(Jsonb *jb, const Datum *path, int path_len, JsonbValue *newval)
int compareJsonbContainers(JsonbContainer *a, JsonbContainer *b)
uint32 getJsonbLength(const JsonbContainer *jc, int index)
char * JsonbToCString(StringInfo out, JsonbContainer *in, int estimated_len)
JsonbIterator * JsonbIteratorInit(JsonbContainer *container)
Datum jsonb_get_element(Jsonb *jb, const Datum *path, int npath, bool *isnull, bool as_text)
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)
struct JsonbInState JsonbInState
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]
JsonbParseState * parseState
struct JsonbIterator * parent
JsonbContainer * container
struct JsonbValue::@146::@147 string
struct JsonbValue::@146::@151 datetime
struct JsonbValue::@146::@149 object
struct JsonbValue::@146::@148 array
struct JsonbValue::@146::@150 binary