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

From Russell Smith
Subject Re: pg_restore ignores -C when using a restore list -L
Date
Msg-id 4BEBC7EB.2070706@pws.com.au
Whole thread Raw
In response to Re: pg_restore ignores -C when using a restore list -L  (Russell Smith <mr-russ@pws.com.au>)
Responses Re: pg_restore ignores -C when using a restore list -L  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 13/05/10 19:26, Russell Smith wrote:
> On 13/05/10 03:39, Tom Lane wrote:
>
>> Russell Smith <mr-russ@pws.com.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.
>
Further to these comments, both scenarios should make -l or -L
incompatibe with -C --data-only -I -n --schema-only -T -t -x  as all
these alter the contents of what is restored.  You should either use the
list to control the items restored or the switches.  Using both just
created confusion.

Regards

Russell

pgsql-bugs by date:

Previous
From: Russell Smith
Date:
Subject: Re: pg_restore ignores -C when using a restore list -L
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #5447: VPATH install postgres.bki