Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 1DC5C1EAB822 for ; Wed, 7 Mar 2012 18:08:45 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S5P2I-0002ZK-4v for pgsql-bugs@postgresql.org; Wed, 07 Mar 2012 22:08:44 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q27M8PI9020362; Wed, 7 Mar 2012 17:08:26 -0500 (EST) To: Phil Sorber cc: Dimitri Fontaine , pgsql-bugs@postgresql.org Subject: Re: Extension tracking temp table and causing update failure In-reply-to: References: <21101.1331071837@sss.pgh.pa.us> <87linc93iq.fsf@hi-media-techno.com> <8167.1331135949@sss.pgh.pa.us> <15629.1331145998@sss.pgh.pa.us> Comments: In-reply-to Phil Sorber message dated "Wed, 07 Mar 2012 14:28:54 -0500" Date: Wed, 07 Mar 2012 17:08:25 -0500 Message-ID: <20361.1331158105@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/62 X-Sequence-Number: 32623 Phil Sorber writes: > On Wed, Mar 7, 2012 at 1:46 PM, Tom Lane wrote: >> 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. Well, I didn't say it wasn't annoying, but it would only be catastrophic if applied to a production database; and it's certainly the sort of thing you'd notice while testing the extension script. Keep in mind that those scripts run as superuser, so they can already do arbitrary amounts of damage to your DB if inadequately tested. If there were a reasonably non-ugly way to deal with the case I'd be willing to put it in, but I don't see one. I think the best we can do is document it. The other case, which only triggers if the script is run in a previously virgin backend ID, scares me a lot more because it's the kind of corner case that could easily escape reasonable testing of an extension script. regards, tom lane