Skip site navigation (1) Skip section navigation (2)

Re: Bug #740: Temp tables not deleted if postmaster

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #740: Temp tables not deleted if postmaster
Date: 2002-08-18 01:31:20
Message-ID: 7065.1029634280@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> At 11:10 17/08/2002 -0400, Tom Lane wrote:
> Temp tables not deleted if postmaster crashes
>> 
>> This is dealt with in current sources, although not in the way you propose.

> Great - what does it do?

Temp-table namespaces are flushed when a backend first attempts to use
one, if it finds any already-existing tables therein.  So a temp table
could survive for awhile after a system crash, but it will be deleted
before it could get in anyone's way.  Also, the odds are good that it
*will* get deleted eventually, while with the old arrangement it might
hang around forever.  (There are at most max_connections distinct
temp-table namespaces in an installation.)

If you're annoyed about the disk space a temp table uses, then a
superuser could remove it with a manual DROP TABLE operation in
advance of any backend happening to assign the temp namespace for use.
This is a little easier than in prior releases because the temp table's
name is not converted into pg_temp_nnn ... you may have to guess about
which temp namespace it's in, but psql can help you out with a schema
wildcard:

regression=# create temp table mytemp(f1 int);
CREATE TABLE
regression=# \d pg_temp_*.mytemp
   Table "pg_temp_1.mytemp"
 Column |  Type   | Modifiers 
--------+---------+-----------
 f1     | integer | 

regression=# -- could do "drop table pg_temp_1.mytemp" here

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Peter EisentrautDate: 2002-08-18 11:20:17
Subject: Re: bug in config for cygwin
Previous:From: Philip WarnerDate: 2002-08-18 01:03:10
Subject: Re: Bug #740: Temp tables not deleted if postmaster

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group