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

Re: Extension tracking temp table and causing update failure

From: Phil Sorber <phil(at)omniti(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Extension tracking temp table and causing update failure
Date: 2012-03-07 19:28:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
On Wed, Mar 7, 2012 at 1:46 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> The attached proposed patch fixes the symptom Phil reported.  However,
> I think we still have some work to do.  I experimented with creating
> temp tables within an extension upgrade script, and found two
> interesting misbehaviors that the patch doesn't fix:
> 1. If you forget to drop the temp table before ending the script,
> then when the session ends and the temp table is forcibly dropped,
> the whole extension goes away (following the rule that a forced drop
> of an extension member makes the whole extension go away).  This is
> mildly annoying, but since not dropping the temp table is a clear bug
> in an extension script, I think we can live with it.

This seems a little bit more than mildly annoying to me. In the CREATE
TABLE docs it reads:

"Temporary tables are automatically dropped at the end of a session..."

On a cursory read through those docs and also section 35.15 on
extensions I see no mention of temp tables not being dropped as a bug.
It seems like it would be an intuitive thing for people to assume that
they wouldn't need to drop them inside of an extension. Also, if I am
understanding this correctly, all objects that depend on said
extension would also get dropped. So, for example, any tables that
have a column with a data type from the extension would also be
dropped. And if that table had foreign key references, all those
tables would get dropped as well. So on and so forth, you get the
idea. This seems like a pretty heavy penalty to pay for what seems
like an easy mistake to make.

In response to


pgsql-bugs by date

Next:From: Merlin MoncureDate: 2012-03-07 20:11:55
Subject: Re: [GENERAL] Altering a table with a rowtype column
Previous:From: Tom LaneDate: 2012-03-07 18:46:38
Subject: Re: Extension tracking temp table and causing update failure

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