Thread: pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
From
Samo Dadela
Date:
Hi,
Can you please take a look at the following?
pg_restore is emitting the following:
pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
The restore is done with:
pg_restore --username=user --host=localhost --port=5432 --dbname=db3 --format=d db-3.20230217102426/db3.pg_dump --clean --if-exists
The backup was done with:
pg_dump --username=user --host=db-3.com --port=5432 --dbname=db3 --file=db-3.20230217102426/db3.pg_dump --format=d --clean --if-exists --no-blobs --jobs=4 --verbose
It seems that the string pg_restore complains about is created by db_restore. I suspect pg_restore wrongly parsed the comment as a
statement that should be prefixed with IF EXISTS.
# pg_restore --version
pg_restore (PostgreSQL) 15.1
# pg_dump --version
pg_dump (PostgreSQL) 15.1
# uname -a
Linux aura 6.0.19-4-MANJARO #1 SMP PREEMPT_DYNAMIC Mon Feb 6 11:26:13 UTC 2023 x86_64 GNU/Linux
Best regards,
Samo
Can you please take a look at the following?
It's just a warning - the restore succeeded anyway.
pg_restore is emitting the following:
pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
The restore is done with:
pg_restore --username=user --host=localhost --port=5432 --dbname=db3 --format=d db-3.20230217102426/db3.pg_dump --clean --if-exists
The backup was done with:
pg_dump --username=user --host=db-3.com --port=5432 --dbname=db3 --file=db-3.20230217102426/db3.pg_dump --format=d --clean --if-exists --no-blobs --jobs=4 --verbose
It seems that the string pg_restore complains about is created by db_restore. I suspect pg_restore wrongly parsed the comment as a
statement that should be prefixed with IF EXISTS.
# pg_restore --version
pg_restore (PostgreSQL) 15.1
# pg_dump --version
pg_dump (PostgreSQL) 15.1
# uname -a
Linux aura 6.0.19-4-MANJARO #1 SMP PREEMPT_DYNAMIC Mon Feb 6 11:26:13 UTC 2023 x86_64 GNU/Linux
Best regards,
Samo
Re: pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
From
Tom Lane
Date:
Samo Dadela <samo.dadela@gmail.com> writes: > Can you please take a look at the following? > It's just a warning - the restore succeeded anyway. > pg_restore is emitting the following: > pg_restore: warning: could not find where to insert IF EXISTS in statement > "-- *not* dropping schema, since initdb creates it This was reported already, and is fixed in 15.2. regards, tom lane
Re: pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
From
Samo Dadela
Date:
Thanks!
On Fri, Feb 17, 2023 at 7:23 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Samo Dadela <samo.dadela@gmail.com> writes:
> Can you please take a look at the following?
> It's just a warning - the restore succeeded anyway.
> pg_restore is emitting the following:
> pg_restore: warning: could not find where to insert IF EXISTS in statement
> "-- *not* dropping schema, since initdb creates it
This was reported already, and is fixed in 15.2.
regards, tom lane