Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Mahendra Singh <mahi6run@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-12-29T12:37:15Z
Lists: pgsql-bugs, pgsql-hackers
On Fri, Dec 27, 2019 at 4:06 AM Michael Paquier <michael@paquier.xyz> wrote: > And committed down to 9.4. We use much more "temporary schema" in > error messages actually, so I have switched to that. I think this was a bad idea and that it should be reverted. It seems to me that the problem here is that you introduced a feature which had a bug, namely that it couldn't tolerate concurrency, and when somebody discovered the bug, you "fixed" it not by making the code able to tolerate concurrent activity but by preventing concurrent activity from happening in the first place. I think that's wrong on general principle. In this specific case, DROP SCHEMA on another temporary sessions's schema is a feature which has existed for a very long time and which I have used on multiple occasions to repair damaged databases. Suppose, for example, there's a catalog entry that prevents the schema from being dropped. Before this commit, you could fix it or delete the entry and then retry the drop. Now, you can't. You can maybe wait for autovacuum to retry it or something, assuming autovacuum is working and you're in multi-user mode. But even if that weren't the case, this seems like a very fragile fix. Maybe someday we'll allow multiple autovacuum workers in the same database, and the problem comes back. Maybe some user who can't drop the schema because of this arbitrary prohibition will find themselves forced to delete the pg_namespace row by hand and then crash the server. Most server code is pretty careful that to either tolerate missing system catalog tuples or elog(ERROR), not crash (e.g. cache lookup failed for ...). This code shouldn't be an exception to that rule. Also, as a matter of procedure, 3 days from first post to commit is not a lot, especially when the day something is posted is Christmas Eve. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Avoid failure if autovacuum tries to access a just-dropped temp namespace.
- d7684c38a5e9 12.3 landed
- 80d76be51cfb 13.0 landed
- 7ea20a2bc6bd 11.8 landed
-
Revert "Forbid DROP SCHEMA on temporary namespaces"
- b83ba2e6e706 9.4.26 landed
- 86949c2f1207 9.5.21 landed
- 50174b70e779 9.6.17 landed
- 0c046f816902 10.12 landed
- 789bc293b341 11.7 landed
- a1c003e5ff82 12.2 landed
- 65192e02441c 13.0 landed
-
Forbid DROP SCHEMA on temporary namespaces
- 898e0c650097 9.4.26 landed
- 12cb5478a2a4 9.5.21 landed
- cb6f94a5219d 9.6.17 landed
- f1958351eae2 10.12 landed
- 786540085dbd 11.7 landed
- 1dd88201ad6e 12.2 landed
- a052f6cbb84e 13.0 landed
-
Make autovacuum more aggressive to remove orphaned temp tables
- 246a6c8f7b23 12.0 cited
-
Code review for early drop of orphaned temp relations in autovacuum.
- dafa0848da11 10.0 cited