On Tue, Dec 1, 2026 at 2:49 PM shveta malik <[email protected]> wrote: > > While reviewing another patch related to CLT, I noticed a concerning > behaviour on HEAD: > > 'ALTER DEFAULT PRIVILEGES IN SCHEMA pg_conflict' is accepted, but the > privileges are not applied to newly created CLTs. This is because > create_conflict_log_table() passes use_user_acl = false to > heap_create_with_catalog(). So the command silently has no effect. See > testcase [1] > > I think this needs handling because CLTs are meant to be queried by > users, and a new CLT gets created for each subscription. So a user > wanting a role (e.g. for monitoring) to read all CLTs would tend to > use ALTER DEFAULT PRIVILEGES, and would get no error or warning that > it did nothing. > > Note that ALTER DEFAULT PRIVILEGES IN SCHEMA pg_toast is also accepted > and not applied to new toast tables, but that does not matter there, > as non-superusers have no USAGE on pg_toast and access toast data only > through the parent table. CLTs, on the other hand, are meant to be > queried by users, so here the user would expect it to work. Thoughts? > > If others also think that this at least needs some handling, here are > the options: > > 1) Emit an error for this command (modify > ExecAlterDefaultPrivilegesStmt?), something like: > ERROR: cannot set default privileges in schema "pg_conflict" > > 2) Document that default privileges are not applied to conflict log > tables, and that privileges must be granted on each CLT after it is > created. > > 3) Let the default privileges be applied to the CLTs (use_user_acl = > true), as the user may need it for monitoring purposes, and thus may > not need to grant privileges on each individual CLT. Note that with > this, global default privileges of the subscription owner (ALTER > DEFAULT PRIVILEGES FOR ROLE ... without IN SCHEMA) will also get > applied to the CLTs. >
In option-3, I am worried that we are giving unintended access to the system managed table to a specified role via ALTER DEFAULT PRIVILEGES FOR ROLE ... We can go with option-2 or 1, I would prefer option-2 to keep the behavior similar to toast and let users explicitly assign privilege to access CLT. -- With Regards, Amit Kapila.
