Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Improve field order in RangeTblEntry
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 5 Mar 2024 12:34:43 +0000 (13:34 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 5 Mar 2024 12:34:43 +0000 (13:34 +0100)
When perminfoindex was added, it was just added at the end of the
block.  It would make sense to keep it closer to more related fields.
In passing, also add an inline comment, like the other fields have.
(Other field reorderings and documentation improvements in
RangeTblEntry are being discussed, but it's better not to mix them
together.)

Discussion: https://www.postgresql.org/message-id/flat/6c1fbccc-85c8-40d3-b08b-4f47f2093711%40eisentraut.org

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

index 2c30bba212434971e27b3dfc55f23216ec6239aa..ef5c58ad102c90960e3987728f77346bee66982a 100644 (file)
@@ -505,8 +505,8 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
            WRITE_OID_FIELD(relid);
            WRITE_CHAR_FIELD(relkind);
            WRITE_INT_FIELD(rellockmode);
-           WRITE_NODE_FIELD(tablesample);
            WRITE_UINT_FIELD(perminfoindex);
+           WRITE_NODE_FIELD(tablesample);
            break;
        case RTE_SUBQUERY:
            WRITE_NODE_FIELD(subquery);
index b1e2f2b440aebf0e9e4b2786b791a8e8e82510c7..70af513614d61795b42062e8b5130332309024e2 100644 (file)
@@ -359,8 +359,8 @@ _readRangeTblEntry(void)
            READ_OID_FIELD(relid);
            READ_CHAR_FIELD(relkind);
            READ_INT_FIELD(rellockmode);
-           READ_NODE_FIELD(tablesample);
            READ_UINT_FIELD(perminfoindex);
+           READ_NODE_FIELD(tablesample);
            break;
        case RTE_SUBQUERY:
            READ_NODE_FIELD(subquery);
index 61790e89ba7005e4e9f6334e07983046ede86eb2..bedc2a0d722ad031072d307c268228d54d0fcc6c 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202403051
+#define CATALOG_VERSION_NO 202403052
 
 #endif
index d60e148ff262e1f0a26927eaad73d7b53bd843bc..24f5c06bb6247c9ad68ab106dd974354ba9f4285 100644 (file)
@@ -1072,8 +1072,8 @@ typedef struct RangeTblEntry
    Oid         relid;          /* OID of the relation */
    char        relkind;        /* relation kind (see pg_class.relkind) */
    int         rellockmode;    /* lock level that query requires on the rel */
+   Index       perminfoindex;  /* index of RTEPermissionInfo entry, or 0 */
    struct TableSampleClause *tablesample;  /* sampling info, or NULL */
-   Index       perminfoindex;
 
    /*
     * Fields valid for a subquery RTE (else NULL):