Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 21C0964FCF9 for ; Wed, 3 Dec 2008 05:01:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 69319-07 for ; Wed, 3 Dec 2008 05:01:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mail.postgresql.org (Postfix) with ESMTP id 1AF8064FC9D for ; Wed, 3 Dec 2008 05:01:51 -0400 (AST) Received: by ey-out-2122.google.com with SMTP id 6so1547532eyi.61 for ; Wed, 03 Dec 2008 01:01:50 -0800 (PST) Received: by 10.210.81.10 with SMTP id e10mr15133704ebb.122.1228294910577; Wed, 03 Dec 2008 01:01:50 -0800 (PST) Received: from ?80.223.223.193? (dsl-hkibrasgw2-fedfdf00-193.dhcp.inet.fi [80.223.223.193]) by mx.google.com with ESMTPS id h1sm7571178nfh.19.2008.12.03.01.01.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Dec 2008 01:01:49 -0800 (PST) Message-ID: <49364AFB.5060404@enterprisedb.com> Date: Wed, 03 Dec 2008 11:01:47 +0200 Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018) MIME-Version: 1.0 To: Emmanuel Cecchet CC: Tom Lane , pgsql-hackers@postgresql.org Subject: Re: Transactions and temp tables References: <48EA7B12.6050906@frogthinker.org> <48EB0551.50205@enterprisedb.com> <48EB95B7.10604@frogthinker.org> <48EC7EB5.5020001@enterprisedb.com> <48ECAA8F.3070306@frogthinker.org> <28137.1223472191@sss.pgh.pa.us> <48ECBBC2.6060003@frogthinker.org> <29132.1223475486@sss.pgh.pa.us> <48EFA13C.2060407@frogthinker.org> <490F804A.60108@enterprisedb.com> <490FB4B3.908@frogthinker.org> <49106B10.2090407@enterprisedb.com> <4910DFC0.3080301@frogthinker.org> <4914CD14.2060608@frogthinker.org> <4921C42A.3030600@enterprisedb.com> <492221A3.1060608@frogthinker.org> <4922A798.7050709@enterprisedb.com> <49232993.1050801@enterprisedb.com> <49243376.2000404@frogthinker.org> <492543D5.9050904@enterprisedb.com> <492B377F.4080602@frogthinker.org> <49344E22.2000008@frogthinker.org> <4934A4E0.8080208@frogthinker.org> In-Reply-To: <4934A4E0.8080208@frogthinker.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit From: Heikki Linnakangas X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/129 X-Sequence-Number: 128758 Emmanuel Cecchet wrote: > There is a problem with temp tables with on delete rows that are created > inside a transaction. > Take the 2pc_on_delete_rows_transaction.sql test case and change the > creation statement, instead of > create temp table foo(x int) on commit delete rows; > try > create temp table foo(x serial primary key) on commit delete rows; > > The test will fail. It looks like the onCommit field is not properly > updated when serial or primary key is used in that context. I did not > figure out why. A serial column uses a sequence behind the scenes. Hmm. Seems like we would need to treat sequences and indexes the same as tables with ON COMMIT DELETE ROWS, i.e release the locks early and don't error out. All in all, this is getting pretty messy. My patch felt a bit hackish to begin with, and having to add special cases for sequences and indexes would make it even more so. And what about temporary views? I'm starting to feel that instead of special-casing temp relations, we need to move into the opposite direction and make temp relations more like regular relations. Unfortunately, that's not going to happen in the 8.4 timeframe :-(. Let's try the other approach in 8.5. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com