Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ir8SP-00046f-Lx for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2020 22:45:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ir8SO-0004jn-1W for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jan 2020 22:45:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ir8SN-0004ja-M6 for pgsql-bugs@lists.postgresql.org; Mon, 13 Jan 2020 22:45:11 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ir8SK-0002cm-Uz for pgsql-bugs@lists.postgresql.org; Mon, 13 Jan 2020 22:45:10 +0000 Received: by mail-qt1-x844.google.com with SMTP id i13so10689124qtr.3 for ; Mon, 13 Jan 2020 14:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=eFagELezNeFUD3LhgoZxm75uu5oEyCQ952veTtqf6iw=; b=12wjCJy/YUMnYnJvPT3dbl+BWbw+P8PwjFwRQ9lPQ7nPLrWYkBSB2KhoVas5h+5SZ1 3DObWmjafXSOOU+ezzcnuFsEMvqBMVqSX/tNLtsh2ULOFFUz95KRj6LIphmmhQu4I32v Ya+9TZmEh4T6zOTHPn4ToXA4JOcxNi2DkJUVQFJftnu2dDA3jjl4Id0jk7VEGnXZ/bhC d7UUYkj2IVTgy3lzLY366ESpEbdbuJvKf5HPhvAHfu7Mfn7WIG+USDk42EMbI0M2jEUT lcnji5ouljdQoRuP+Oi0WKTP8RILI7MDYsHs1p8Zvk2aGOAc/j5PGsvI7lFlb7u/WfNw 1z5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=eFagELezNeFUD3LhgoZxm75uu5oEyCQ952veTtqf6iw=; b=Ry3KOYK6WKSqe8k/VmvssDHoSoeaMC89V5wsKzx2lkcp87z4nWkhftgfVlO6XqJeCq II+lEuy1BimuzX7ygSLzLv8Hz79GUMhzsLW4aoaPDcfFD4OcE9HbHimXlEmywzkdIN6L hSifVOH5/BVeoNBOiWYiz9VM1rsTig8pJUTvJXomggQFQQl0egZWBFP3UKCYQefr/82S +plM6HBUrdLkFLYb7h8x/3NQxd0I1v6KgLNJ6wPuvmSsUyQHyKU4p5Rtg252AP308XM6 WEn3qN4g3ff0DLUUu1Y/BsqWREbwHGDTo5Bu1b4Xr1DpXT+eXINk/mrY4SH/S0dNazGJ o9mA== X-Gm-Message-State: APjAAAUSKdrZXDwzUVq8X9F1kWnXWNVKKKuDDxpz41iMDFbxUSdqVgez FuKjDwoNGXN7/gk9ZXZ64a/ssQ== X-Google-Smtp-Source: APXvYqyGr98P7dRVtLsbvJKda+WrVJjbAViJ/umzgwzXXxhFKxF6CoZxpVNVglpKZFGGVZusV4R21w== X-Received: by 2002:ac8:37d3:: with SMTP id e19mr866435qtc.361.1578955508143; Mon, 13 Jan 2020 14:45:08 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.95.19.128]) by smtp.gmail.com with ESMTPSA id m68sm5696864qke.17.2020.01.13.14.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 14:45:07 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 14FA330081F; Mon, 13 Jan 2020 19:45:06 -0300 (-03) Date: Mon, 13 Jan 2020 19:45:06 -0300 From: Alvaro Herrera To: Mithun Cy Cc: PostgreSQL Hackers , PostgreSQL mailing lists Subject: Re: DROP OWNED CASCADE vs Temp tables Message-ID: <20200113224506.GA5833@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jan-07, Mithun Cy wrote: > 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. Cute. This seems fiddly to handle better; maybe you'd have to have a new PERFORM_DELETION_* flag that says to ignore "missing" objects; so when you go from shdepDropOwned, you pass that flag all the way down to doDeletion(), so the objtype-specific function is called with "missing_ok", and ignore if the object has already gone away. That's tedious because none of the Remove* functions have the concept of missing_ok. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services