Make node output prefix match node structure name
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 15 Sep 2021 14:35:41 +0000 (16:35 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 15 Sep 2021 14:35:41 +0000 (16:35 +0200)
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.

Discussion: https://www.postgresql.org/message-id/c091e5cd-45f8-69ee-6a9b-de86912cc7e7@enterprisedb.com

src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c

index f2a6a6e7a08f76e58131e4e6c04a1a60eb1b6949..6b290737a6d6d506025b3465fcdf28e20159b5e7 100644 (file)
@@ -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);
index 0dd1ad7dfce73346e0972cab7b889aa5b8e75feb..01aee85bd4592ce396f0545c04182727ce23682f 100644 (file)
@@ -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();