1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
From 77ccce8560f0fa862759c98f56585e8ff1c1a2a5 Mon Sep 17 00:00:00 2001
From: Umar Hayat <m.umarkiani@gmail.com>
Date: Thu, 7 Nov 2024 10:56:00 +0900
Subject: [PATCH] Add support for PG17
- 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)
---
src/backend/nodes/ag_nodes.c | 2 +-
src/backend/parser/cypher_analyze.c | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/backend/nodes/ag_nodes.c b/src/backend/nodes/ag_nodes.c
index e20670b2b..54bd27314 100644
--- a/src/backend/nodes/ag_nodes.c
+++ b/src/backend/nodes/ag_nodes.c
@@ -156,7 +156,7 @@ ExtensibleNode *_new_ag_node(Size size, ag_node_tag tag)
{
ExtensibleNode *n;
- n = (ExtensibleNode *)palloc0fast(size);
+ n = (ExtensibleNode *)palloc0(size);
n->type = T_ExtensibleNode;
n->extnodename = node_names[tag];
diff --git a/src/backend/parser/cypher_analyze.c b/src/backend/parser/cypher_analyze.c
index 128acd0fb..d293df8b0 100644
--- a/src/backend/parser/cypher_analyze.c
+++ b/src/backend/parser/cypher_analyze.c
@@ -174,6 +174,8 @@ static bool convert_cypher_walker(Node *node, ParseState *pstate)
* OpExpr - expression node for an operator invocation
* Const - constant value or expression node
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
+ * JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for
+ * SQL/JSON constructors
*
* These are a special case that needs to be ignored.
*
@@ -181,7 +183,8 @@ static bool convert_cypher_walker(Node *node, ParseState *pstate)
if (IsA(funcexpr, SQLValueFunction)
|| IsA(funcexpr, CoerceViaIO)
|| IsA(funcexpr, Var) || IsA(funcexpr, OpExpr)
- || IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr))
+ || IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr)
+ || IsA(funcexpr, JsonConstructorExpr))
{
return false;
}
@@ -346,6 +349,8 @@ static bool is_func_cypher(FuncExpr *funcexpr)
* OpExpr - expression node for an operator invocation
* Const - constant value or expression node
* BoolExpr - expression node for the basic Boolean operators AND, OR, NOT
+ * JsonConstructorExpr - wrapper over FuncExpr/Aggref/WindowFunc for
+ * SQL/JSON constructors
*
* These are a special case that needs to be ignored.
*
@@ -353,7 +358,8 @@ static bool is_func_cypher(FuncExpr *funcexpr)
if (IsA(funcexpr, SQLValueFunction)
|| IsA(funcexpr, CoerceViaIO)
|| IsA(funcexpr, Var) || IsA(funcexpr, OpExpr)
- || IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr))
+ || IsA(funcexpr, Const) || IsA(funcexpr, BoolExpr)
+ || IsA(funcexpr, JsonConstructorExpr))
{
return false;
}
|