Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-17 Thread Tom Lane
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 >

Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-17 Thread Jeff Davis
On Sun, 2012-12-16 at 21:17 -0500, Tom Lane wrote: > I wrote: > > 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 ==

Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-16 Thread Tom Lane
I wrote: > 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 thi

Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-16 Thread Tom Lane
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

Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-14 Thread Jeff Davis
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, someb

Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-14 Thread Tom Lane
I wrote: > I'm not sure where rd_backend gets set up, but maybe we can fix this > by not allowing rd_backend to acquire a valid value unless we've begun > using the temp namespace. The key bit of code seems to be this in RelationBuildDesc(): switch (relation->rd_rel->relpersistence) .

Re: [BUGS] Bug with temporary child of a permanent table after recovery

2012-12-14 Thread Tom Lane
Heikki Linnakangas writes: > Spotted by accident while working on a patch: > Open psql and do: > CREATE TABLE uctest(f1 int, f2 text); > -- Create a temporary child of the permanent table > CREATE TEMP TABLE ucchild () inherits (uctest); > In another terminal: > pg_ctl stop -m immediate > pg_ctl