Обсуждение: pg_restore unexpected end of file

Поиск
Список
Период
Сортировка

pg_restore unexpected end of file

От
Les
Дата:
I'm trying to migrate a database from version 11 to version 15.

I have created a dump file on v11:

pg_dump --dbname=not_telling -Fc --no-owner > dump

Then I was trying to import it on v15:

pg_restore -v --dbname=not_telling --no-user /restore/dump
pg_restore: error: could not read from input file: end of file

The file is 525MB. First I thought that maybe the dump is corrupt, so I re-dumped the db again, but I got the same results. pg_dump does not report any error, but pg_restore cannot import it.

I can try to export into SQL format, but there is another (much larger) database that I need to migrate, and it has large binary blobs inside. I would prefer the custom format.

Is the custom dump format of v11 compatible with v15? 

Thank you,

   Laszlo

Re: pg_restore unexpected end of file

От
Adrian Klaver
Дата:
On 9/7/23 23:29, Les wrote:
> I'm trying to migrate a database from version 11 to version 15.
> 
> I have created a dump file on v11:
> 
> pg_dump --dbname=not_telling -Fc --no-owner > dump

--no-owner is ignored for non-text outputs. It is handled on the 
pg_restore end.

> 
> Then I was trying to import it on v15:
> 
> pg_restore -v --dbname=not_telling --no-user /restore/dump

I'm guessing it was actually --no-owner not --no-user?

> pg_restore: error: could not read from input file: end of file

Are:

 > dump

and

/restore/dump

pointing at the same thing?

Was the dump file transferred from one location to another?

If so how?

> Is the custom dump format of v11 compatible with v15?

Yes it is.

https://www.postgresql.org/docs/current/app-pgdump.html

"Because pg_dump is used to transfer data to newer versions of 
PostgreSQL, the output of pg_dump can be expected to load into 
PostgreSQL server versions newer than pg_dump's version. pg_dump can 
also dump from PostgreSQL servers older than its own version. 
(Currently, servers back to version 9.2 are supported.) However, pg_dump 
cannot dump from PostgreSQL servers newer than its own major version; it 
will refuse to even try, rather than risk making an invalid dump. Also, 
it is not guaranteed that pg_dump's output can be loaded into a server 
of an older major version — not even if the dump was taken from a server 
of that version. Loading a dump file into an older server may require 
manual editing of the dump file to remove syntax not understood by the 
older server. Use of the --quote-all-identifiers option is recommended 
in cross-version cases, as it can prevent problems arising from varying 
reserved-word lists in different PostgreSQL versions."

> 
> Thank you,
> 
>     Laszlo
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com