Make RangeTblEntry dump order consistent
authorPeter Eisentraut <[email protected]>
Fri, 22 Mar 2024 06:12:28 +0000 (07:12 +0100)
committerPeter Eisentraut <[email protected]>
Fri, 22 Mar 2024 06:28:33 +0000 (07:28 +0100)
Put the fields alias and eref earlier in the struct, so that it
matches the order in _outRangeTblEntry()/_readRangeTblEntry().  This
helps if we ever want to fully automate out/read of RangeTblEntry.
Also, it makes dumps in the debugger easier to read in the same way.
Internally, this makes no difference.

Reviewed-by: Andrew Dunstan <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/4b27fc50-8cd6-46f5-ab20-88dbaadca645@eisentraut.org

src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/include/catalog/catversion.h
src/include/nodes/parsenodes.h

index 29cbc83bd9ff5ed7a6be0beece960ca7b0b51fcb..c55375e7f917217b956333b0e1f941e6e44359c4 100644 (file)
@@ -494,7 +494,6 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
 {
    WRITE_NODE_TYPE("RANGETBLENTRY");
 
-   /* put alias + eref first to make dump more legible */
    WRITE_NODE_FIELD(alias);
    WRITE_NODE_FIELD(eref);
    WRITE_ENUM_FIELD(rtekind, RTEKind);
index a122407c880aaf551c79e49c0ff6b39731b96665..c4d01a441a030528f5b8b0918ea3f3d36d5f7a05 100644 (file)
@@ -348,7 +348,6 @@ _readRangeTblEntry(void)
 {
    READ_LOCALS(RangeTblEntry);
 
-   /* put alias + eref first to make dump more legible */
    READ_NODE_FIELD(alias);
    READ_NODE_FIELD(eref);
    READ_ENUM_FIELD(rtekind, RTEKind);
index 3c4e49b73a03a410d85ba1058144f824c4ff7d59..a52bb137a9b583ddfa7e5ed5376ecab3f3a5279f 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202403202
+#define CATALOG_VERSION_NO 202403221
 
 #endif
index 1ea3b8f0b107d8379a1373dc08b6e056fd3cea0b..298a682833103f37316f34ff5e0e4abc3c0c0b21 100644 (file)
@@ -1027,6 +1027,16 @@ typedef struct RangeTblEntry
 
    NodeTag     type;
 
+   /*
+    * Fields valid in all RTEs:
+    *
+    * put alias + eref first to make dump more legible
+    */
+   /* user-written alias clause, if any */
+   Alias      *alias pg_node_attr(query_jumble_ignore);
+   /* expanded reference names */
+   Alias      *eref pg_node_attr(query_jumble_ignore);
+
    RTEKind     rtekind;        /* see above */
 
    /*
@@ -1218,10 +1228,6 @@ typedef struct RangeTblEntry
    /*
     * Fields valid in all RTEs:
     */
-   /* user-written alias clause, if any */
-   Alias      *alias pg_node_attr(query_jumble_ignore);
-   /* expanded reference names */
-   Alias      *eref pg_node_attr(query_jumble_ignore);
    /* was LATERAL specified? */
    bool        lateral pg_node_attr(query_jumble_ignore);
    /* present in FROM clause? */