Re: Logical replication - schema change not invalidating the relation cache
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-07-03T05:53:06Z
Lists: pgsql-hackers
On Fri, Jul 2, 2021 at 12:03 PM Dilip Kumar <dilipbalaut@gmail.com> wrote: > > Yeah, this looks like a bug. I will look at the patch. > While looking into this, I think the main cause of the problem is that schema rename does not invalidate the relation cache right? I also tried other cases e.g. if there is an open cursor and we rename the schema CREATE SCHEMA sch1; CREATE TABLE sch1.t1(c1 int); insert into sch1.t1 values(1); insert into sch1.t1 values(2); insert into sch1.t1 values(3); BEGIN; DECLARE mycur CURSOR FOR SELECT * FROM sch1.t1; FETCH NEXT FROM mycur ; ----------At this point rename sch1 to sch2 from another session------ FETCH NEXT FROM mycur ; UPDATE sch2.t1 SET c1 = 20 WHERE CURRENT OF mycur; select * from sch2.t1 ; So even after the schema rename the cursor is able to fetch and its also able to update on the same table in the new schema, ideally using CURRENT OF CUR, you can update the same table for which you have declared the cursor. I am giving this example because this behavior also looks somewhat similar. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com
Commits
-
Invalidate pgoutput's replication-decisions cache upon schema rename.
- cd4b2334db49 16.0 landed
-
Add wait_for_subscription_sync for TAP tests.
- 0c20dd33db16 16.0 cited
-
Unify PostgresNode's new() and get_new_node() methods
- 201a76183e20 15.0 cited