Re: Ignore invalid indexes in pg_dump - Mailing list pgsql-hackers

From Josh Kupershmidt
Subject Re: Ignore invalid indexes in pg_dump
Date
Msg-id CAK3UJRHZCWJiBKiGc8THpUfQ0t78D2j1Q160bQLkZxZynakoug@mail.gmail.com
Whole thread Raw
In response to Re: Ignore invalid indexes in pg_dump  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: Ignore invalid indexes in pg_dump
List pgsql-hackers
On Wed, Mar 20, 2013 at 2:00 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> On 20 March 2013 02:51, Michael Paquier <michael.paquier@gmail.com> wrote:
>
>> If failures happen with CREATE INDEX CONCURRENTLY, the system will be let
>> with invalid indexes. I don't think that the user would like to see invalid
>> indexes of
>> an existing system being recreated as valid after a restore.
>> So why not removing from a dump invalid indexes with something like the
>> patch
>> attached?
>> This should perhaps be applied in pg_dump for versions down to 8.2 where
>> CREATE
>> INDEX CONCURRENTLY has been implemented?
>
> Invalid also means currently-in-progress, so it would be better to keep them in.

For invalid indexes which are left hanging around in the database, if
the index definition is included by pg_dump, it will likely cause pain
during the restore. If the index build failed the first time and
hasn't been manually dropped and recreated since then, it's a good bet
it will fail the next time. Errors during restore can be more than
just a nuisance; consider restores with --single-transaction.

And if the index is simply currently-in-progress, it seems like the
expected behavior would be for pg_dump to ignore it anyway. We don't
include other DDL objects which are not yet committed while pg_dump is
running.

Josh



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Problem with background worker
Next
From: Tom Lane
Date:
Subject: Re: Ignore invalid indexes in pg_dump