Re: Proposal: Conflict log history table for Logical Replication
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>,
shveta malik <shveta.malik@gmail.com>, Nisha Moond <nisha.moond412@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-06-16T10:41:55Z
Lists: pgsql-hackers
On Tue, Jun 16, 2026 at 9:27 AM vignesh C <vignesh21@gmail.com> wrote: > > On Mon, 15 Jun 2026 at 14:20, Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > 2. Views are disallowed, but functions are allowed > > > Creating a view in the pg_conflict schema is rejected: > > > postgres=# CREATE VIEW v1 AS > > > SELECT * FROM pg_conflict.pg_conflict_log_16435; > > > ERROR: permission denied to create "pg_conflict.v1" > > > DETAIL: Conflict schema modifications are currently disallowed. > > > > > > However, creating a function in the same schema succeeds: > > > CREATE FUNCTION pg_conflict.get_conflict_count() > > > RETURNS bigint > > > LANGUAGE sql > > > AS $$ > > > SELECT count(*) FROM pg_conflict.pg_conflict_log_16404; > > > $$; > > > CREATE FUNCTION > > > > > > > This is okay because the function is doing SELECT which we allow on > > these tables. > > Shouldn’t creating a view also be allowed for the same reason? > > The function is permitted because it only performs a SELECT on the > conflict log table, and such read operations are allowed. A view > likewise represents a stored query definition and does not modify the > conflict schema or its underlying tables. Given that direct queries on > the conflict log tables are already permitted, allowing users to > define views over them is consistent with the same rationale applied > to functions. o ensure we are aligned, I want to clarify the current behavior before we decide on the next steps. Currently, view and function creation are both permitted for toast and conflict tables. However, there is a discrepancy in the schemas: view creation is blocked in the 'pg_conflict' and 'pg_toast' schemas, while function creation is allowed in both. So IIUC we need to take a call whether the function creation should be blocked in pg_conflict schema or not, logically we can say it can be blocked but we might need to discuss on this because it's allowed in the `pg_toast` schema. And if we are worried about the descripency that functions are allowed in this schema but views are not, I don't think we need to worry about this, this is an existing behaviour for toast also and if we want to can investigate as a separate thread and fix it for system schema al together? Am I missing something here? postgres[2205601]=# CREATE VIEW v2 AS select * from pg_toast.pg_toast_16412; CREATE VIEW postgres[2205601]=# CREATE VIEW v3 AS select * from pg_conflict.pg_conflict_log_16406; CREATE VIEW CREATE VIEW pg_toast.v5 AS select * from pg_toast.pg_toast_16412; ERROR: 42501: permission denied to create "pg_toast.v5" DETAIL: System catalog modifications are currently disallowed. LOCATION: heap_create, heap.c:322 postgres[2205601]=# CREATE VIEW pg_conflict.v5 AS select * from pg_conflict.pg_conflict_log_16406; ERROR: 42501: permission denied to create "pg_conflict.v5" DETAIL: Conflict schema modifications are currently disallowed. LOCATION: heap_create, heap.c:329 postgres[2205601]=# CREATE FUNCTION pg_conflict.get_conflict_count() RETURNS bigint LANGUAGE sql AS $$ SELECT count(*) FROM pg_conflict.pg_conflict_log_16406; $$; CREATE FUNCTION postgres[2205601]=# CREATE FUNCTION pg_toast.get_toast_count() RETURNS bigint LANGUAGE sql AS $$ SELECT count(*) FROM pg_toast.pg_toast_16412; $$; CREATE FUNCTION -- Regards, Dilip Kumar Google
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Allow logical replication conflicts to be logged to a table.
- a5918fddf10d master landed
-
Avoid orphaned objects dependencies
- 2fbb21170e90 19 (unreleased) cited