Hello, We tried importing into an empty database in PG 12 from the dump that was created in PG 10. Import was successful but we got an message that an error was ignored. We agin imported with -e option and the following message was printed: pg_restore: while PROCESSING TOC: pg_restore: from TOC entry 6; 2615 2200 SCHEMA public postgres pg_restore: error: could not execute query: ERROR:
schema "public" already exists Command was: CREATE SCHEMA public; There are some blogs that ar pointing to that fact the error is because of different versions of PG Admin Utility namely different versions of pg_dump() and pg_resotre() command in source and destination versions. We use the following command
for pg_dump and pg_restore. pg_dump -U postgres -h 127.0.0.1 --verbose --port=5432 -j 5 -Fd mydb --no-synchronized-snapshots -f /var/mydata/dbbackup pg_restore -W -h 127.0.0.1 -p 5432 -U postgres -d mydb -v "/var/mydata/dbbackup" To mitigate the same, we took SQL (.sql) dump of the above database in PG10 and restored in an empty database in PG12, it worked. Using this process, we migrated our database from PG10 to 12. To confirm whether the problem is really because of the difference in version, we performed 2 exercises, let’s call them approaches. Let me narrate them below. Approach 1:
Conclusion of Approach 1:
Approach 2:
Conclusion of Approach 2:
Question to you all:
PS: Below is the command we use to create database: CREATE DATABASE mydb WITH ENCODING 'UTF8' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0; Thanks & Regards Pranjal Shukla |