Skip to content

Commit 7b22343

Browse files
authored
Add support for PG17 (#2130)
- A new node type is introduced for JSON support, that is JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for SQL/JSON constructors. - Added additional checks for JsonConstructorExpr expression node for which the walker would crash. - Removed palloc0fast function call (which is not available in PG17)
1 parent c75d9e4 commit 7b22343

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/backend/nodes/ag_nodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ExtensibleNode *_new_ag_node(Size size, ag_node_tag tag)
156156
{
157157
ExtensibleNode *n;
158158

159-
n = (ExtensibleNode *)palloc0fast(size);
159+
n = (ExtensibleNode *)palloc0(size);
160160
n->type = T_ExtensibleNode;
161161
n->extnodename = node_names[tag];
162162

src/backend/parser/cypher_analyze.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,17 @@ static bool convert_cypher_walker(Node *node, ParseState *pstate)
174174
* OpExpr - expression node for an operator invocation
175175
* Const - constant value or expression node
176176
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
177+
* JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for
178+
* SQL/JSON constructors
177179
*
178180
* These are a special case that needs to be ignored.
179181
*
180182
*/
181183
if (IsA(funcexpr, SQLValueFunction)
182184
|| IsA(funcexpr, CoerceViaIO)
183185
|| IsA(funcexpr, Var) || IsA(funcexpr, OpExpr)
184-
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr))
186+
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr)
187+
|| IsA(funcexpr, JsonConstructorExpr))
185188
{
186189
return false;
187190
}
@@ -346,14 +349,17 @@ static bool is_func_cypher(FuncExpr *funcexpr)
346349
* OpExpr - expression node for an operator invocation
347350
* Const - constant value or expression node
348351
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
352+
* JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for
353+
* SQL/JSON constructors
349354
*
350355
* These are a special case that needs to be ignored.
351356
*
352357
*/
353358
if (IsA(funcexpr, SQLValueFunction)
354359
|| IsA(funcexpr, CoerceViaIO)
355360
|| IsA(funcexpr, Var) || IsA(funcexpr, OpExpr)
356-
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr))
361+
|| IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr)
362+
|| IsA(funcexpr, JsonConstructorExpr))
357363
{
358364
return false;
359365
}

0 commit comments

Comments
 (0)