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

Re: Unlogged tables cannot be truncated twice

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>, Greg Sabino Mullane <greg(at)endpoint(dot)com>
Subject: Re: Unlogged tables cannot be truncated twice
Date: 2011-05-31 01:27:22
Message-ID: 1306805168-sup-4188@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-bugs
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 <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-bugs by date

Next:From: Alex HunsakerDate: 2011-05-31 02:32:01
Subject: Re: 9.1 plperlu bug with null rows in trigger hash
Previous:From: Andres FreundDate: 2011-05-31 00:47:49
Subject: Re: Unlogged tables cannot be truncated twice

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