Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ff88671

Browse files
author
Nikita Glukhov
committed
Add jsonpath item flags
1 parent 5c0f7fb commit ff88671

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/backend/utils/adt/jsonpath.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,10 @@ jsonPathToCstring(StringInfo out, JsonPath *in, int estimated_len)
252252
/*****************************INPUT/OUTPUT************************************/
253253

254254
static inline int32
255-
appendJsonPathItemHeader(StringInfo buf, JsonPathItemType type)
255+
appendJsonPathItemHeader(StringInfo buf, JsonPathItemType type, char flags)
256256
{
257257
appendStringInfoChar(buf, (char) type);
258+
appendStringInfoChar(buf, (char) flags);
258259

259260
/*
260261
* We align buffer to int32 because a series of int32 values often goes
@@ -283,7 +284,7 @@ copyJsonPathItem(JsonPathContext *cxt, JsonPathItem *item, int level,
283284

284285
check_stack_depth();
285286

286-
nextOffs = appendJsonPathItemHeader(buf, item->type);
287+
nextOffs = appendJsonPathItemHeader(buf, item->type, item->flags);
287288

288289
switch (item->type)
289290
{
@@ -592,7 +593,7 @@ flattenJsonPathParseItem(JsonPathContext *cxt, JsonPathParseItem *item,
592593
pos = copyJsonPath(cxt, item->value.binary, nestingLevel, &last, &next);
593594
else
594595
{
595-
next = appendJsonPathItemHeader(buf, item->type);
596+
next = appendJsonPathItemHeader(buf, item->type, item->flags);
596597
last = pos;
597598
}
598599

@@ -1319,6 +1320,7 @@ jspInitByBuffer(JsonPathItem *v, char *base, int32 pos)
13191320
v->base = base + pos;
13201321

13211322
read_byte(v->type, base, pos);
1323+
read_byte(v->flags, base, pos);
13221324
pos = INTALIGN((uintptr_t) (base + pos)) - (uintptr_t) base;
13231325
read_int32(v->nextPos, base, pos);
13241326

@@ -1602,6 +1604,7 @@ jspInitParseItem(JsonPathParseItem *item, JsonPathItemType type,
16021604
item = palloc(sizeof(*item));
16031605

16041606
item->type = type;
1607+
item->flags = 0;
16051608
item->next = next;
16061609

16071610
return item;

src/backend/utils/adt/jsonpath_gram.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ makeItemType(JsonPathItemType type)
354354
CHECK_FOR_INTERRUPTS();
355355

356356
v->type = type;
357+
v->flags = 0;
357358
v->next = NULL;
358359

359360
return v;

src/include/utils/jsonpath.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ typedef enum JsonPathItemType
131131
typedef struct JsonPathItem
132132
{
133133
JsonPathItemType type;
134+
uint8 flags;
134135

135136
/* position form base to next node */
136137
int32 nextPos;
@@ -236,6 +237,7 @@ typedef struct JsonPathParseItem JsonPathParseItem;
236237
struct JsonPathParseItem
237238
{
238239
JsonPathItemType type;
240+
uint8 flags;
239241
JsonPathParseItem *next; /* next in path */
240242

241243
union

0 commit comments

Comments
 (0)