]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Replace some hard-wired OID constants with corresponding macros.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Feb 2026 04:15:20 +0000 (23:15 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Feb 2026 04:15:20 +0000 (23:15 -0500)
Looking again at commit 7cdb633c8, I wondered why we have hard-wired
"1034" for the OID of type aclitem[].  Some other entries in the same
array have numeric type OIDs as well.  This seems to be a hangover
from years ago when not every built-in pg_type entry had an OID macro.
But since we made genbki.pl responsible for generating these macros,
there are macros available for all these array types, so there's no
reason not to follow the project policy of never writing numeric OID
constants in C code.

src/backend/bootstrap/bootstrap.c

index e8f825b3d65deef59a01f8db3f00b24a881f3819..7d32cd0e159366c21f8451e7e7960c2fe73cdf7e 100644 (file)
@@ -131,13 +131,13 @@ static const struct typinfo TypInfo[] = {
        F_OIDVECTORIN, F_OIDVECTOROUT},
        {"_int4", INT4ARRAYOID, INT4OID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
        F_ARRAY_IN, F_ARRAY_OUT},
-       {"_text", 1009, TEXTOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
+       {"_text", TEXTARRAYOID, TEXTOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
        F_ARRAY_IN, F_ARRAY_OUT},
-       {"_oid", 1028, OIDOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
+       {"_oid", OIDARRAYOID, OIDOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
        F_ARRAY_IN, F_ARRAY_OUT},
-       {"_char", 1002, CHAROID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
+       {"_char", CHARARRAYOID, CHAROID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
        F_ARRAY_IN, F_ARRAY_OUT},
-       {"_aclitem", 1034, ACLITEMOID, -1, false, TYPALIGN_DOUBLE, TYPSTORAGE_EXTENDED, InvalidOid,
+       {"_aclitem", ACLITEMARRAYOID, ACLITEMOID, -1, false, TYPALIGN_DOUBLE, TYPSTORAGE_EXTENDED, InvalidOid,
        F_ARRAY_IN, F_ARRAY_OUT}
 };