DROP OWNED CASCADE vs Temp tables

From: Mithun Cy <mithun(dot)cy(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: DROP OWNED CASCADE vs Temp tables
Date: 2020-01-07 07:22:00
Message-ID: CADq3xVZTbzK4ZLKq+dn_vB4QafXXbmMgDP3trY-GuLnib2Ai1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I have a test where a user creates a temp table and then disconnect,
concurrently we try to do DROP OWNED BY CASCADE on the same user. Seems
this causes race condition between temptable deletion during disconnection
(@RemoveTempRelations(myTempNamespace)) and DROP OWNED BY CASCADE operation
which will try to remove same temp table when they find them as part of
pg_shdepend. Which will result in internal error cache lookup failed as
below.

DROP OWNED BY test_role CASCADE;
2020-01-07 12:35:06.524 IST [26064] ERROR: cache lookup failed for
relation 41019
2020-01-07 12:35:06.524 IST [26064] STATEMENT: DROP OWNED BY test_role
CASCADE;
reproduce.sql:8: ERROR: cache lookup failed for relation 41019

TEST
=====================
create database test_db;
create user test_superuser superuser;
\c test_db test_superuser
CREATE ROLE test_role nosuperuser login password 'test_pwd' ;
\c test_db test_role
CREATE TEMPORARY TABLE tmp_table(col1 int);
\c test_db test_superuser
DROP OWNED BY test_role CASCADE;

--
Thanks and Regards
Mithun Chicklore Yogendra
EnterpriseDB: http://www.enterprisedb.com

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Chatur Gopalkrishna 2020-01-07 09:15:44 Unable to fork: Resource Unavailable
Previous Message Andres Freund 2020-01-07 06:45:08 Re: BUG #16190: The usage of NULL pointer in refint.c

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-07 08:05:11 Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Previous Message Michael Paquier 2020-01-07 07:02:57 Re: TRUNCATE on foreign tables