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

pg_restore ignores -C when using a restore list -L

From: Russell Smith <mr-russ(at)pws(dot)com(dot)au>
To: PostgreSQL-Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: pg_restore ignores -C when using a restore list -L
Date: 2010-05-12 09:57:41
Message-ID: 4BEA7B95.1080602@pws.com.au (view raw or flat)
Thread:
Lists: pgsql-bugs
Hi,

pg_restore silently ignores the inclusion of -C when you do use a
restore list.

postgres$ pg_dump -Fc postgres > postgres.dump
postgres$ pg_restore -C postgres.dump | grep 'CREATE DATABASE'
CREATE DATABASE postgres WITH TEMPLATE = template0 ENCODING = 'UTF8';

## Create a restore list
postgres$ pg_restore -l postgres.dump > list.txt
## Attempt to restore using the list
postgres$ pg_restore -L list -C postgres.dump | grep 'CREATE DATABASE'


The final result does not include an \connect or CREATE DATABASE
statements.  Expected behavior would be to have CREATE DATABASE in both
cases.  It would be at least desirable to remove the footgun and error
if you are not allowed to use -C in this context.

The example above does not involve the use of -d as a connection
database.  The results are particularly unexpected when you restore an
entire database into the postgres by using  pg_restore -L list -C -d
postgres big_db.dump.

Regards

Russell


Responses

pgsql-bugs by date

Next:From: Koichi SuzukiDate: 2010-05-12 10:21:10
Subject: Bug-fix and new feature of pg_lesslog is released
Previous:From: Russell SmithDate: 2010-05-12 09:47:15
Subject: Re: PostgreSQL 8.4 - dumping database connection privileges

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