0004-Make-node-output-prefix-match-node-structure-name.patch
text/plain
Filename: 0004-Make-node-output-prefix-match-node-structure-name.patch
Type: text/plain
Part: 3
Patch
Format: format-patch
Series: patch 0004
Subject: Make node output prefix match node structure name
| File | + | − |
|---|---|---|
| src/backend/nodes/outfuncs.c | 11 | 11 |
| src/backend/nodes/readfuncs.c | 11 | 11 |
From a65730f24753c759cd14f828aed9d5a3137cd531 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 17 Aug 2021 15:51:45 +0200
Subject: [PATCH 4/5] Make node output prefix match node structure name
In most cases, the prefix string in a node output is the upper case of
the node structure name, e.g., MergeAppend -> MERGEAPPEND. There were
a few exceptions that for either no apparent reason or perhaps minor
aesthetic reasons deviated from this. In order to simplify this and
perhaps allow automatic generation without having to deal with
exception cases, make them all match.
Regularize node type serialization in some cases
---
src/backend/nodes/outfuncs.c | 22 +++++++++++-----------
src/backend/nodes/readfuncs.c | 22 +++++++++++-----------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 50ed59bb4a..09cfce05b1 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -1472,7 +1472,7 @@ _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
static void
_outCollateExpr(StringInfo str, const CollateExpr *node)
{
- WRITE_NODE_TYPE("COLLATE");
+ WRITE_NODE_TYPE("COLLATEEXPR");
WRITE_NODE_FIELD(arg);
WRITE_OID_FIELD(collOid);
@@ -1482,7 +1482,7 @@ _outCollateExpr(StringInfo str, const CollateExpr *node)
static void
_outCaseExpr(StringInfo str, const CaseExpr *node)
{
- WRITE_NODE_TYPE("CASE");
+ WRITE_NODE_TYPE("CASEEXPR");
WRITE_OID_FIELD(casetype);
WRITE_OID_FIELD(casecollid);
@@ -1495,7 +1495,7 @@ _outCaseExpr(StringInfo str, const CaseExpr *node)
static void
_outCaseWhen(StringInfo str, const CaseWhen *node)
{
- WRITE_NODE_TYPE("WHEN");
+ WRITE_NODE_TYPE("CASEWHEN");
WRITE_NODE_FIELD(expr);
WRITE_NODE_FIELD(result);
@@ -1515,7 +1515,7 @@ _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
static void
_outArrayExpr(StringInfo str, const ArrayExpr *node)
{
- WRITE_NODE_TYPE("ARRAY");
+ WRITE_NODE_TYPE("ARRAYEXPR");
WRITE_OID_FIELD(array_typeid);
WRITE_OID_FIELD(array_collid);
@@ -1528,7 +1528,7 @@ _outArrayExpr(StringInfo str, const ArrayExpr *node)
static void
_outRowExpr(StringInfo str, const RowExpr *node)
{
- WRITE_NODE_TYPE("ROW");
+ WRITE_NODE_TYPE("ROWEXPR");
WRITE_NODE_FIELD(args);
WRITE_OID_FIELD(row_typeid);
@@ -1540,7 +1540,7 @@ _outRowExpr(StringInfo str, const RowExpr *node)
static void
_outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
{
- WRITE_NODE_TYPE("ROWCOMPARE");
+ WRITE_NODE_TYPE("ROWCOMPAREEXPR");
WRITE_ENUM_FIELD(rctype, RowCompareType);
WRITE_NODE_FIELD(opnos);
@@ -1553,7 +1553,7 @@ _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
static void
_outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
{
- WRITE_NODE_TYPE("COALESCE");
+ WRITE_NODE_TYPE("COALESCEEXPR");
WRITE_OID_FIELD(coalescetype);
WRITE_OID_FIELD(coalescecollid);
@@ -1564,7 +1564,7 @@ _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
static void
_outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
{
- WRITE_NODE_TYPE("MINMAX");
+ WRITE_NODE_TYPE("MINMAXEXPR");
WRITE_OID_FIELD(minmaxtype);
WRITE_OID_FIELD(minmaxcollid);
@@ -2807,7 +2807,7 @@ _outAlterStatsStmt(StringInfo str, const AlterStatsStmt *node)
static void
_outNotifyStmt(StringInfo str, const NotifyStmt *node)
{
- WRITE_NODE_TYPE("NOTIFY");
+ WRITE_NODE_TYPE("NOTIFYSTMT");
WRITE_STRING_FIELD(conditionname);
WRITE_STRING_FIELD(payload);
@@ -2816,7 +2816,7 @@ _outNotifyStmt(StringInfo str, const NotifyStmt *node)
static void
_outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
{
- WRITE_NODE_TYPE("DECLARECURSOR");
+ WRITE_NODE_TYPE("DECLARECURSORSTMT");
WRITE_STRING_FIELD(portalname);
WRITE_INT_FIELD(options);
@@ -3238,7 +3238,7 @@ _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
static void
_outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
{
- WRITE_NODE_TYPE("RTE");
+ WRITE_NODE_TYPE("RANGETBLENTRY");
/* put alias + eref first to make dump more legible */
WRITE_NODE_FIELD(alias);
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index 0dd1ad7dfc..01aee85bd4 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -2795,23 +2795,23 @@ parseNodeString(void)
return_value = _readArrayCoerceExpr();
else if (MATCH("CONVERTROWTYPEEXPR", 18))
return_value = _readConvertRowtypeExpr();
- else if (MATCH("COLLATE", 7))
+ else if (MATCH("COLLATEEXPR", 11))
return_value = _readCollateExpr();
- else if (MATCH("CASE", 4))
+ else if (MATCH("CASEEXPR", 8))
return_value = _readCaseExpr();
- else if (MATCH("WHEN", 4))
+ else if (MATCH("CASEWHEN", 8))
return_value = _readCaseWhen();
else if (MATCH("CASETESTEXPR", 12))
return_value = _readCaseTestExpr();
- else if (MATCH("ARRAY", 5))
+ else if (MATCH("ARRAYEXPR", 9))
return_value = _readArrayExpr();
- else if (MATCH("ROW", 3))
+ else if (MATCH("ROWEXPR", 7))
return_value = _readRowExpr();
- else if (MATCH("ROWCOMPARE", 10))
+ else if (MATCH("ROWCOMPAREEXPR", 14))
return_value = _readRowCompareExpr();
- else if (MATCH("COALESCE", 8))
+ else if (MATCH("COALESCEEXPR", 12))
return_value = _readCoalesceExpr();
- else if (MATCH("MINMAX", 6))
+ else if (MATCH("MINMAXEXPR", 10))
return_value = _readMinMaxExpr();
else if (MATCH("SQLVALUEFUNCTION", 16))
return_value = _readSQLValueFunction();
@@ -2845,17 +2845,17 @@ parseNodeString(void)
return_value = _readOnConflictExpr();
else if (MATCH("APPENDRELINFO", 13))
return_value = _readAppendRelInfo();
- else if (MATCH("RTE", 3))
+ else if (MATCH("RANGETBLENTRY", 13))
return_value = _readRangeTblEntry();
else if (MATCH("RANGETBLFUNCTION", 16))
return_value = _readRangeTblFunction();
else if (MATCH("TABLESAMPLECLAUSE", 17))
return_value = _readTableSampleClause();
- else if (MATCH("NOTIFY", 6))
+ else if (MATCH("NOTIFYSTMT", 10))
return_value = _readNotifyStmt();
else if (MATCH("DEFELEM", 7))
return_value = _readDefElem();
- else if (MATCH("DECLARECURSOR", 13))
+ else if (MATCH("DECLARECURSORSTMT", 17))
return_value = _readDeclareCursorStmt();
else if (MATCH("PLANNEDSTMT", 11))
return_value = _readPlannedStmt();
--
2.32.0