pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it - Mailing list pgsql-bugs

From Samo Dadela
Subject pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
Date
Msg-id CAFuecfNL96=mKTq71Q6h3297u15+1RnD2D7kmj3+ak++79k1bA@mail.gmail.com
Whole thread Raw
Responses Re: pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
List pgsql-bugs
Hi,

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

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17798: Incorrect memory access occurs when using BEFORE ROW UPDATE trigger
Next
From: Tom Lane
Date:
Subject: Re: pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it