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

From: Samo Dadela <samo(dot)dadela(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: pg_restore: warning: could not find where to insert IF EXISTS in statement "-- *not* dropping schema, since initdb creates it
Date: 2023-02-17 11:21:25
Message-ID: CAFuecfNL96=mKTq71Q6h3297u15+1RnD2D7kmj3+ak++79k1bA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

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