Re: pg_restore ignores -C when using a restore list -L

From: Russell Smith <mr-russ(at)pws(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pg_restore ignores -C when using a restore list -L
Date: 2010-05-13 09:26:09
Message-ID: 4BEBC5B1.7090109@pws.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 13/05/10 03:39, Tom Lane wrote:
> Russell Smith <mr-russ(at)pws(dot)com(dot)au> writes:
>
>> pg_restore silently ignores the inclusion of -C when you do use a
>> restore list.
>>
> It would work as you expect if you use -C when creating the list file.
> The reason for this is that -C basically means "don't skip the DATABASE
> entry". When you use -l without -C, you get a list file that doesn't
> include the DATABASE entry. In the last step, you need both -C and
> the DATABASE entry listed in the list file in order to have the CREATE
> DATABASE command emitted.
>
> We could possibly "fix" this by emitting the DATABASE entry during -l
> with or without -C. I'm not sure if that would have any bad side
> effects, but a quick test suggests that it will still skip the DATABASE
> entry if it's listed in the list file but -C isn't given. Of course,
> if you manually remove the DATABASE entry from the list file, you lose
> anyway.
>
By the operation of other items (-C --data-only) passed with -l, it only
produces to contents that would be restored with the other switches
provided. If that's expect behavior, then the documentation of the
switch is incorrect and should read something more like

-l
--list List the items in the archive that would be restored
taking into account any other switches provided. The output of this
operation can be used with the -L option to further restrict and
reorder the items that are restored.

Something like that as documentation for the switch would be clearer
about what it's actually doing. The previous statement of listing the
contents of the archive is clearly not what the switch is doing.

If -l really should list the contents of the archive, then it must list
the entire contents all the time.

Regards

Russell

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Russell Smith 2010-05-13 09:35:39 Re: pg_restore ignores -C when using a restore list -L
Previous Message Koichi Suzuki 2010-05-13 06:21:12 Re: Re: [ANNOUNCE] Bug-fix and new feature of pg_lesslog is released