Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkLgi-0000yx-KU for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Dec 2012 21:23:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TkLgi-0006Er-3r for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Dec 2012 21:23:56 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkLgg-0006DV-Er for pgsql-bugs@postgresql.org; Sun, 16 Dec 2012 21:23:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkLgf-0000nB-6b for pgsql-bugs@postgresql.org; Sun, 16 Dec 2012 21:23:53 +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 qBGLNo2q007384; Sun, 16 Dec 2012 16:23:50 -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: <1355534626.32384.6.camel@sussancws0025> References: <50CB1455.3080002@vmware.com> <2959.1355507033@sss.pgh.pa.us> <8740.1355525814@sss.pgh.pa.us> <1355534626.32384.6.camel@sussancws0025> Comments: In-reply-to Jeff Davis message dated "Fri, 14 Dec 2012 17:23:45 -0800" Date: Sun, 16 Dec 2012 16:23:50 -0500 Message-ID: <7383.1355693030@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 Fri, 2012-12-14 at 17:56 -0500, Tom Lane wrote: >> Perhaps a better idea is to not overload rd_backend to serve both >> the "physical name of file" purpose and the "is it my temp table" >> purpose. We could add an additional relcache field with the >> three possible states "not temp, my temp, somebody else's temp" >> and make sure that the third state gets selected when there's >> a chance collision like this. Or resurrect the old rd_istemp and >> rd_islocaltemp flags. > Rather than bring back that flag, can we just use isTempOrToastNamespace > within RELATION_IS_OTHER_TEMP? > #define RELATION_IS_OTHER_TEMP(relation) \ > ((relation)->rd_rel->relpersistence == RELPERSISTENCE_TEMP \ > && !isTempOrToastNamespace((relation)->rd_rel->relnamespace)) Meh. I think this would work, but we would also have to change RELATION_IS_LOCAL to use isTempOrToastNamespace similarly. While RELATION_IS_OTHER_TEMP doesn't seem to be used in any performance-critical places (since it's generally checked no more than once per command), I'm less willing to assume that it's okay to add cycles to RELATION_IS_LOCAL. On the whole I think resurrecting the rd_islocaltemp flag might be the best thing. We can keep the use of "relpersistence == RELPERSISTENCE_TEMP" to do what rd_istemp used to do, it's just the equation of "rd_backend == MyBackendId" with "is my temp table" that's bogus. And this way gets rid of some unnecessary cross-branch coding differences. 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