pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Bug with temporary child of a permanent table after recovery
Date: Sun, 16 Dec 2012 16:23:50 -0500
Message-ID: <7383.1355693030@sss.pgh.pa.us> (raw)
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Jeff Davis <pgsql@j-davis.com> 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



view thread (8+ messages)  latest in thread

Message-ID: <7383.1355693030@sss.pgh.pa.us>
Permalink:  ../7383.1355693030@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7383.1355693030@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql@j-davis.com, robertmhaas@gmail.com, hlinnakangas@vmware.com
  Subject: Re: Bug with temporary child of a permanent table after recovery
  In-Reply-To: <7383.1355693030@sss.pgh.pa.us>
  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>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox