mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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 and Himanshu Upadhyaya. Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru
This commit is contained in:
@@ -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
|
||||
*/
|
||||
@@ -3358,6 +3388,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
|
||||
|
Reference in New Issue
Block a user