Re: pg_restore unexpected end of file

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Les <nagylzs(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_restore unexpected end of file
Date: 2023-09-08 15:40:01
Message-ID: 03247ca4-9b31-7136-2228-6f65d5258612@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Les 2023-09-08 19:36:11 pgsql --echo-errors --quiet and setval
Previous Message Adrian Klaver 2023-09-08 15:27:45 Re: Even if I have a lot of free space PgSQL returns "ERROR: could not extend file - No space left on device"