Re: Extension tracking temp table and causing update failure - Mailing list pgsql-bugs

From Phil Sorber
Subject Re: Extension tracking temp table and causing update failure
Date
Msg-id CADAkt-hoHAk+ftm5ft3TN1B1id7C65s2evDZZ598SLKEHLu_Pg@mail.gmail.com
Whole thread Raw
In response to Re: Extension tracking temp table and causing update failure  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Extension tracking temp table and causing update failure
List pgsql-bugs
On Wed, Mar 7, 2012 at 1:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The attached proposed patch fixes the symptom Phil reported. =A0However,
> I think we still have some work to do. =A0I 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). =A0This 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.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Extension tracking temp table and causing update failure
Next
From: Merlin Moncure
Date:
Subject: Re: [GENERAL] Altering a table with a rowtype column