Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 8915EB5DCEF for ; Mon, 30 May 2011 22:27:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 22691-01 for ; Tue, 31 May 2011 01:27:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 7A4C3B5DC6A for ; Mon, 30 May 2011 22:27:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 13E43348045; Mon, 30 May 2011 18:27:29 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GmkJH+dwrqyM; Mon, 30 May 2011 18:27:27 -0700 (PDT) Received: from perhan.alvh.no-ip.org (unknown [190.95.16.242]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id CB125348044; Mon, 30 May 2011 18:27:26 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 09DB66E394; Mon, 30 May 2011 21:27:22 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-bugs , =?utf-8?q?C=C3=A9dric_Villemain?= , Greg Sabino Mullane Subject: Re: Unlogged tables cannot be truncated twice From: Alvaro Herrera To: Andres Freund In-reply-to: <201105310247.50055.andres@anarazel.de> References: <20110530160043.GC3012@core.home> <201105310214.00791.andres@anarazel.de> <201105310235.58484.andres@anarazel.de> <201105310247.50055.andres@anarazel.de> Date: Mon, 30 May 2011 21:27:22 -0400 Message-Id: <1306805168-sup-4188@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201105/231 X-Sequence-Number: 30370 Excerpts from Andres Freund's message of lun may 30 20:47:49 -0400 2011: > On Tuesday, May 31, 2011 02:35:58 AM Andres Freund wrote: > > On Tuesday, May 31, 2011 02:14:00 AM Andres Freund wrote: > > > On Tuesday, May 31, 2011 01:56:05 AM Cédric Villemain wrote: > > > > I remove my own explanations as we conclude on the same thing. > > > > Attached is the fix by adding a (!reindex) in the index.c if(). > > > > > > Thats imo wrong because it will break a plain REINDEX? > > > > > I think one possible correct fix would be the attached: > > My version was wrong as well because it did not observe RelationTruncate's > > nblocks argument. That function is used to "shorten" the relation in > > vacuum. So dropping the init fork there is not a good idea. > > > > So I think it is the simpler version of simply checking the existance of > > the fork before creating is ok. Hmm, I wonder if what we should be doing here is observe isreindex in index_build to avoid creating the init fork. Doing smgr access at that level seems wrong. > Gna. gnargl. Coffe. Bed. ;) > > There was an accidental hunk I added while removing some whitespace. That > would not have been good on a real commit. > > Argh. Hah :-) -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support