On Wednesday, May 19, 2021 1:52 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > > I am not sure but I > > > > think we should prohibit truncate on user_catalog_tables as we > > > > prohibit truncate on system catalog tables (see below [1]) if we > > > > want plugin to lock them, otherwise, as you said it might lead to > deadlock. > > > > For the matter, I think we should once check all other operations > > > > where we can take an exclusive lock on [user]_catalog_table, say > > > > Cluster command, and compare the behavior of same on system > > > > catalog tables. > > > > > > > > [1] > > > > postgres=# truncate pg_class; > > > > ERROR: permission denied: "pg_class" is a system catalog > > > > postgres=# cluster pg_class; > > > > ERROR: there is no previously clustered index for table "pg_class" > > > > > > > > > > Please ignore the cluster command as we need to use 'using index' > > > with that command to make it successful. I just want to show the > > > truncate command behavior for which you have asked the question. > > Thank you so much for clarifying the direction. > > I agree with the changing the TRUNCATE side. > > I'll make a patch based on this. > > > > Isn't it a better idea to start a new thread where you can summarize whatever > we have discussed here about user_catalog_tables? We might get the opinion > from others about the behavior change you are proposing. You are right. So, I've launched it with the patch for this.
Best Regards, Takamichi Osumi