]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Nail pg_parameter_acl in relcache.
authorJeff Davis <jdavis@postgresql.org>
Tue, 23 Jun 2026 19:06:33 +0000 (12:06 -0700)
committerJeff Davis <jdavis@postgresql.org>
Tue, 23 Jun 2026 19:19:52 +0000 (12:19 -0700)
Previously, a parameter specified in the startup packet for a physical
replication connection could encounter an error trying to perform an
ACL check for the setting.

Problem was introduced in a0ffa885e4, but no reasonable back-patchable
solution was found, so fixing only in master.

Bumps catversion.

Discussion: https://postgr.es/m/d8f8e11f06d692fff89e6be0f22732d30cf695a0.camel%40j-davis.com
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
src/backend/utils/cache/catcache.c
src/backend/utils/cache/relcache.c
src/include/catalog/catversion.h
src/include/catalog/pg_parameter_acl.h

index a8e7bf649d23f6a7839acdbb5cdd3d89306f02b8..6fb35dedf95e9a0a5d354526ea9252ca54f2a506 100644 (file)
@@ -1335,6 +1335,8 @@ IndexScanOK(CatCache *cache)
                case AUTHOID:
                case AUTHMEMMEMROLE:
                case DATABASEOID:
+               case PARAMETERACLNAME:
+               case PARAMETERACLOID:
 
                        /*
                         * Protect authentication lookups occurring before relcache has
index 0572ab424e71eeaf159ba0f5fd2cb3f3a5de36e3..fb4e042be8adfcc275018e06cdc370a646fcf3dd 100644 (file)
@@ -56,6 +56,7 @@
 #include "catalog/pg_proc.h"
 #include "catalog/pg_publication.h"
 #include "catalog/pg_rewrite.h"
+#include "catalog/pg_parameter_acl.h"
 #include "catalog/pg_shseclabel.h"
 #include "catalog/pg_statistic_ext.h"
 #include "catalog/pg_subscription.h"
@@ -120,6 +121,7 @@ static const FormData_pg_attribute Desc_pg_auth_members[Natts_pg_auth_members] =
 static const FormData_pg_attribute Desc_pg_index[Natts_pg_index] = {Schema_pg_index};
 static const FormData_pg_attribute Desc_pg_shseclabel[Natts_pg_shseclabel] = {Schema_pg_shseclabel};
 static const FormData_pg_attribute Desc_pg_subscription[Natts_pg_subscription] = {Schema_pg_subscription};
+static const FormData_pg_attribute Desc_pg_parameter_acl[Natts_pg_parameter_acl] = {Schema_pg_parameter_acl};
 
 /*
  *             Hash tables that index the relation cache
@@ -4084,8 +4086,10 @@ RelationCacheInitializePhase2(void)
                                  Natts_pg_shseclabel, Desc_pg_shseclabel);
                formrdesc("pg_subscription", SubscriptionRelation_Rowtype_Id, true,
                                  Natts_pg_subscription, Desc_pg_subscription);
+               formrdesc("pg_parameter_acl", ParameterAclRelation_Rowtype_Id, true,
+                                 Natts_pg_parameter_acl, Desc_pg_parameter_acl);
 
-#define NUM_CRITICAL_SHARED_RELS       5       /* fix if you change list above */
+#define NUM_CRITICAL_SHARED_RELS       6       /* fix if you change list above */
        }
 
        MemoryContextSwitchTo(oldcxt);
@@ -4206,9 +4210,10 @@ RelationCacheInitializePhase3(void)
         * non-shared catalogs at all.  Autovacuum calls InitPostgres with a
         * database OID, so it instead depends on DatabaseOidIndexId.  We also
         * need to nail up some indexes on pg_authid and pg_auth_members for use
-        * during client authentication.  SharedSecLabelObjectIndexId isn't
-        * critical for the core system, but authentication hooks might be
-        * interested in it.
+        * during client authentication.  We need indexes on pg_parameter_acl for
+        * ACL checks on settings specified in the startup packet for a physical
+        * replication connection.  SharedSecLabelObjectIndexId isn't critical for
+        * the core system, but authentication hooks might be interested in it.
         */
        if (!criticalSharedRelcachesBuilt)
        {
@@ -4224,8 +4229,12 @@ RelationCacheInitializePhase3(void)
                                                        AuthMemRelationId);
                load_critical_index(SharedSecLabelObjectIndexId,
                                                        SharedSecLabelRelationId);
+               load_critical_index(ParameterAclParnameIndexId,
+                                                       ParameterAclRelationId);
+               load_critical_index(ParameterAclOidIndexId,
+                                                       ParameterAclRelationId);
 
-#define NUM_CRITICAL_SHARED_INDEXES 6  /* fix if you change list above */
+#define NUM_CRITICAL_SHARED_INDEXES 8  /* fix if you change list above */
 
                criticalSharedRelcachesBuilt = true;
        }
index fba78c20733814f60b41c2608e6e5e9e3a1e4f3e..04eb2af2ac870c62d03c2748db6a14502221a819 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     202606231
+#define CATALOG_VERSION_NO     202606232
 
 #endif
index a26b05a9bf2e4e11252805ccde49b8d781a0727d..902e2666069c8ddfee9dba4e0a21e87196860e4b 100644 (file)
@@ -29,7 +29,7 @@
  */
 BEGIN_CATALOG_STRUCT
 
-CATALOG(pg_parameter_acl,6243,ParameterAclRelationId) BKI_SHARED_RELATION
+CATALOG(pg_parameter_acl,6243,ParameterAclRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2173,ParameterAclRelation_Rowtype_Id) BKI_SCHEMA_MACRO
 {
        Oid                     oid;                    /* oid */