Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkhqD-0007wp-VU for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Dec 2012 21:03:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TkhqD-0005TB-56 for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Dec 2012 21:03:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkhqC-0005Su-9T for pgsql-bugs@postgresql.org; Mon, 17 Dec 2012 21:03:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tkhq5-0005y4-Uu for pgsql-bugs@postgresql.org; Mon, 17 Dec 2012 21:03:11 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qBHL33U5007105; Mon, 17 Dec 2012 16:03:03 -0500 (EST) From: Tom Lane To: Jeff Davis cc: Robert Haas , Heikki Linnakangas , Pg Bugs Subject: Re: Bug with temporary child of a permanent table after recovery In-reply-to: <1355776026.24766.39.camel@sussancws0025> References: <50CB1455.3080002@vmware.com> <2959.1355507033@sss.pgh.pa.us> <8740.1355525814@sss.pgh.pa.us> <1355534626.32384.6.camel@sussancws0025> <7383.1355693030@sss.pgh.pa.us> <28278.1355710658@sss.pgh.pa.us> <1355776026.24766.39.camel@sussancws0025> Comments: In-reply-to Jeff Davis message dated "Mon, 17 Dec 2012 12:27:06 -0800" Date: Mon, 17 Dec 2012 16:03:03 -0500 Message-ID: <7104.1355778183@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Jeff Davis writes: > On Sun, 2012-12-16 at 21:17 -0500, Tom Lane wrote: >> One thing I noticed that maybe needs more work is that tablecmds.c in >> general seems mighty willing to hack upon temp tables belonging to other >> sessions. I added tests for that in the places where there already were >> checks on relpersistence, but I wonder whether we ought not simply >> forbid all forms of ALTER on nonlocal temp rels, right up at the top. > Do you see any path where an ALTER can get a hold on a non-local temp > table? Or do you just mean as a sanity check? Either way, blocking it at > the top sounds good to me. Well, if you're not a superuser then you shouldn't be able to access non-local temp tables at all, because they live in schemas you won't have permissions for. So what we're discussing here is mainly just protecting superusers from shooting themselves in the foot. But, given that there are any protections at all against non-local temp tables in the code (and there are quite a number of such checks), I'm wondering why ALTER TABLE doesn't have a blanket rejection. Even for catalog updates that don't involve direct touches of the file data (which is certainly unsafe because of local vs shared buffer handling), it seems risky because we also have various places that skip taking locks on local temp tables. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs