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
71 #define DatumGetJsonbP(d) ((Jsonb *) PG_DETOAST_DATUM(d))
72 #define DatumGetJsonbPCopy(d) ((Jsonb *) PG_DETOAST_DATUM_COPY(d))
73 #define JsonbPGetDatum(p) PointerGetDatum(p)
74 #define PG_GETARG_JSONB_P(x) DatumGetJsonbP(PG_GETARG_DATUM(x))
75 #define PG_GETARG_JSONB_P_COPY(x) DatumGetJsonbPCopy(PG_GETARG_DATUM(x))
76 #define PG_RETURN_JSONB_P(x) PG_RETURN_POINTER(x)
146 #define JENTRY_OFFLENMASK 0x0FFFFFFF
147 #define JENTRY_TYPEMASK 0x70000000
148 #define JENTRY_HAS_OFF 0x80000000
151 #define JENTRY_ISSTRING 0x00000000
152 #define JENTRY_ISNUMERIC 0x10000000
153 #define JENTRY_ISBOOL_FALSE 0x20000000
154 #define JENTRY_ISBOOL_TRUE 0x30000000
155 #define JENTRY_ISNULL 0x40000000
156 #define JENTRY_ISCONTAINER 0x50000000
159 #define JBE_OFFLENFLD(je_) ((je_) & JENTRY_OFFLENMASK)
160 #define JBE_HAS_OFF(je_) (((je_) & JENTRY_HAS_OFF) != 0)
161 #define JBE_ISSTRING(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISSTRING)
162 #define JBE_ISNUMERIC(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNUMERIC)
163 #define JBE_ISCONTAINER(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISCONTAINER)
164 #define JBE_ISNULL(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISNULL)
165 #define JBE_ISBOOL_TRUE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_TRUE)
166 #define JBE_ISBOOL_FALSE(je_) (((je_) & JENTRY_TYPEMASK) == JENTRY_ISBOOL_FALSE)
167 #define JBE_ISBOOL(je_) (JBE_ISBOOL_TRUE(je_) || JBE_ISBOOL_FALSE(je_))
170 #define JBE_ADVANCE_OFFSET(offset, je) \
173 if (JBE_HAS_OFF(je_)) \
174 (offset) = JBE_OFFLENFLD(je_); \
176 (offset) += JBE_OFFLENFLD(je_); \
186 #define JB_OFFSET_STRIDE 32
208 #define JB_CMASK 0x0FFFFFFF
209 #define JB_FSCALAR 0x10000000
210 #define JB_FOBJECT 0x20000000
211 #define JB_FARRAY 0x40000000
214 #define JsonContainerSize(jc) ((jc)->header & JB_CMASK)
215 #define JsonContainerIsScalar(jc) (((jc)->header & JB_FSCALAR) != 0)
216 #define JsonContainerIsObject(jc) (((jc)->header & JB_FOBJECT) != 0)
217 #define JsonContainerIsArray(jc) (((jc)->header & JB_FARRAY) != 0)
227 #define JB_ROOT_COUNT(jbp_) (*(uint32 *) VARDATA(jbp_) & JB_CMASK)
228 #define JB_ROOT_IS_SCALAR(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FSCALAR) != 0)
229 #define JB_ROOT_IS_OBJECT(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FOBJECT) != 0)
230 #define JB_ROOT_IS_ARRAY(jbp_) ((*(uint32 *) VARDATA(jbp_) & JB_FARRAY) != 0)
305 #define IsAJsonbScalar(jsonbval) (((jsonbval)->type >= jbvNull && \
306 (jsonbval)->type <= jbvBool) || \
307 (jsonbval)->type == jbvDatetime)
404 const char *keyVal,
int keyLen,
419 uint64 *
hash, uint64 seed);
436 bool *isnull,
bool as_text);
#define FLEXIBLE_ARRAY_MEMBER
static void PGresult * res
Datum jsonb_from_text(text *js, bool unique_keys)
Datum to_jsonb_worker(Datum val, JsonbTypeCategory tcategory, Oid outfuncoid)
JsonbIterator * JsonbIteratorInit(JsonbContainer *container)
Jsonb * JsonbValueToJsonb(JsonbValue *val)
const char * JsonbTypeName(JsonbValue *jb)
struct JsonbParseState JsonbParseState
Datum jsonb_build_array_worker(int nargs, Datum *args, bool *nulls, Oid *types, bool absent_on_null)
JsonbValue * getIthJsonbValueFromContainer(JsonbContainer *sheader, uint32 i)
Datum jsonb_build_object_worker(int nargs, Datum *args, bool *nulls, Oid *types, bool absent_on_null, bool unique_keys)
void jsonb_categorize_type(Oid typoid, JsonbTypeCategory *tcategory, Oid *outfuncoid)
Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, JsonbValue *newval)
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 * JsonbToCStringIndent(StringInfo out, JsonbContainer *in, int estimated_len)
char * JsonbUnquote(Jsonb *jb)
JsonbValue * findJsonbValueFromContainer(JsonbContainer *sheader, uint32 flags, JsonbValue *key)
void JsonbHashScalarValue(const JsonbValue *scalarVal, uint32 *hash)
Jsonb * JsonbMakeEmptyArray(void)
JsonbValue * getKeyJsonValueFromContainer(JsonbContainer *container, const char *keyVal, int keyLen, JsonbValue *res)
void JsonbToJsonbValue(Jsonb *jsonb, JsonbValue *val)
JsonbIteratorToken JsonbIteratorNext(JsonbIterator **it, JsonbValue *val, bool skipNested)
JsonbValue * pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq, JsonbValue *jbval)
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)
char * JsonbToCString(StringInfo out, JsonbContainer *in, int estimated_len)
bool JsonbDeepContains(JsonbIterator **val, JsonbIterator **mContained)
bool to_jsonb_is_immutable(Oid typoid)
Jsonb * JsonbMakeEmptyObject(void)
struct JsonbContainer JsonbContainer
static unsigned hash(unsigned *uv, int n)
JEntry children[FLEXIBLE_ARRAY_MEMBER]
struct JsonbIterator * parent
JsonbContainer * container
struct JsonbParseState * next
struct JsonbValue::@130::@131 string
struct JsonbValue::@130::@134 binary
struct JsonbValue::@130::@132 array
struct JsonbValue::@130::@135 datetime
struct JsonbValue::@130::@133 object