Thread: BUG #3691: bug in pg_restore

BUG #3691: bug in pg_restore

From
"Maryz"
Date:
The following bug has been logged online:

Bug reference:      3691
Logged by:          Maryz
Email address:      mairambija@gmail.com
PostgreSQL version: 8.0-8.3b
Operating system:   WinXP
Description:        bug in pg_restore
Details:

In Postgres 8.0-8.2 and now 8.3b backup data in other schemas (not public
schema) with pg_dump. Later with pg_restore I can't restore it.
For example dump:
pg_dump.exe --format=custom -b -i --disable-triggers -h localhost -p 5432 -U
postgres -a postgres -f dmp\other.itm_blygis.out -t other.itm_blygis

Restore:
pg_restore.exe -h localhost -p 5432 -U postgres -a postgres --format=c -a -i
--disable-triggers  -t other.itm_blygis -v dmp\other.itm_blygis.out

Maybe it's not a bug. Maybe I do something wrong?

Re: BUG #3691: bug in pg_restore

From
"Heikki Linnakangas"
Date:
Maryz wrote:
> The following bug has been logged online:
>
> Bug reference:      3691
> Logged by:          Maryz
> Email address:      mairambija@gmail.com
> PostgreSQL version: 8.0-8.3b
> Operating system:   WinXP
> Description:        bug in pg_restore
> Details:
>
> In Postgres 8.0-8.2 and now 8.3b backup data in other schemas (not public
> schema) with pg_dump. Later with pg_restore I can't restore it.
> For example dump:
> pg_dump.exe --format=custom -b -i --disable-triggers -h localhost -p 5432 -U
> postgres -a postgres -f dmp\other.itm_blygis.out -t other.itm_blygis
>
> Restore:
> pg_restore.exe -h localhost -p 5432 -U postgres -a postgres --format=c -a -i
> --disable-triggers  -t other.itm_blygis -v dmp\other.itm_blygis.out

What's the error you get?

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

Re: BUG #3691: bug in pg_restore

From
"Heikki Linnakangas"
Date:
Please keep the list cc'd.

Mairambija wrote:
> On screen see only:
> pg_restore connecting to database for restore
>
> No any errors. And after this process no data on table.

>>> Restore:
>>> pg_restore.exe -h localhost -p 5432 -U postgres -a postgres --format=c
>> -a -i
>>> --disable-triggers  -t other.itm_blygis -v dmp\other.itm_blygis.out

Actually that restore command line looks wrong. I get a "could not open
input file "postgres": No such file or directory" when I try that.
You've also specified -a twice, though that shouldn't matter.

If you still can't get it to work, please post the *exact* and complete
commands and output you get.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

Re: BUG #3691: bug in pg_restore

From
Tom Lane
Date:
"Maryz" <mairambija@gmail.com> writes:
> Restore:
> pg_restore.exe -h localhost -p 5432 -U postgres -a postgres --format=c -a -i
> --disable-triggers  -t other.itm_blygis -v dmp\other.itm_blygis.out

pg_restore's -t switch doesn't do schemas.  You need something like
     -n other -t itm_blygis
instead.  This is something we should improve someday, but it's not a
bug --- it's operating as designed.

Actually, given that you selected only the one table while dumping, the
whole thing is a waste of typing effort, as are many of the other
switches you used.  There's no need to tell pg_restore not to restore
stuff that's not in the dump file, hm?

Another bit of advice: do not use the -i switch for either of these
programs.  Ever.  I do not know why the meme has spread that this switch
is a good thing to use by default.  What it is is a large-caliber foot
gun.

            regards, tom lane