diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2022-03-03 13:00:49 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2022-03-27 17:03:33 -0400 |
commit | f79b803dcc98d707450e158db3638dc67ff8380b (patch) | |
tree | a9c33df51b967eeb99b86af92008f7f0bc1e3d6e /src/backend/nodes/equalfuncs.c | |
parent | b64c3bd62ea7064a1a36fbd921e8955fa76faa3e (diff) |
Common SQL/JSON clauses
This introduces some of the building blocks used by the SQL/JSON
constructor and query functions. Specifically, it provides node
executor and grammar support for the FORMAT JSON [ENCODING foo]
clause, and values decorated with it, and for the RETURNING clause.
The following SQL/JSON patches will leverage these.
Nikita Glukhov (who probably deserves an award for perseverance).
Reviewers have included (in no particular order) Andres Freund, Alexander
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.
Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru
Diffstat (limited to 'src/backend/nodes/equalfuncs.c')
-rw-r--r-- | src/backend/nodes/equalfuncs.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 0f330e3c701..e73b351acdc 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -841,6 +841,36 @@ _equalOnConflictExpr(const OnConflictExpr *a, const OnConflictExpr *b) return true; } +static bool +_equalJsonFormat(const JsonFormat *a, const JsonFormat *b) +{ + COMPARE_SCALAR_FIELD(format_type); + COMPARE_SCALAR_FIELD(encoding); + COMPARE_LOCATION_FIELD(location); + + return true; +} + +static bool +_equalJsonReturning(const JsonReturning *a, const JsonReturning *b) +{ + COMPARE_NODE_FIELD(format); + COMPARE_SCALAR_FIELD(typid); + COMPARE_SCALAR_FIELD(typmod); + + return true; +} + +static bool +_equalJsonValueExpr(const JsonValueExpr *a, const JsonValueExpr *b) +{ + COMPARE_NODE_FIELD(raw_expr); + COMPARE_NODE_FIELD(formatted_expr); + COMPARE_NODE_FIELD(format); + + return true; +} + /* * Stuff from pathnodes.h */ @@ -3359,6 +3389,15 @@ equal(const void *a, const void *b) case T_JoinExpr: retval = _equalJoinExpr(a, b); break; + case T_JsonFormat: + retval = _equalJsonFormat(a, b); + break; + case T_JsonReturning: + retval = _equalJsonReturning(a, b); + break; + case T_JsonValueExpr: + retval = _equalJsonValueExpr(a, b); + break; /* * RELATION NODES |