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