Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#3727 closed defect (invalid)

Hard upgrade failed - pg_restore: [archiver] could not find entry for ID 6

Reported by: milosh Owned by: strk
Priority: medium Milestone: PostGIS 2.3.3
Component: build/upgrade/install Version: 2.3.x
Keywords: Cc:


I'm trying to hard upgrade spatial db from:

PostgreSQL 9.3.16, compiled by Visual C++ build 1600, 64-bit POSTGIS="2.1.3 r12547" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER


PostgreSQL 9.6.2, compiled by Visual C++ build 1800, 64-bit POSTGIS="2.3.2 r15302" GEOS="3.6.1-CAPI-1.10.1 r4317" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.1.3, released 2017/20/01" LIBXML="2.7.8" LIBJSON="0.12" TOPOLOGY RASTER

When running

perl "%PGINSTALL%\utils\" "%BACKUPFILE%"

the command prints the following output:

Converting test_96_upgrade.backup to ASCII on stdout...

Reading list of functions to ignore... Writing manifest of things to read from dump file... Writing ASCII to stdout...

pg_restore: [archiver] could not find entry for ID 6


No data are restored in the target DB.

The modified manifest file differs only in:

+9; 2615 5665374 SCHEMA - topology postgres

Change History (5)

comment:1 Changed 3 years ago by milosh

The following does not work either:

pg_restore -l test.backup > test.backup.lst

pg_restore -L test.backup.lst > test2.out

second pg_restore ends up with:

pg_restore: [archiver] could not find entry for ID 6

comment:2 Changed 3 years ago by milosh

Resolution: invalid
Status: newclosed

Found the root cause:

Foreign Key constraint with new line in its name created by hand in the distant past by copypasting sql from wrapped terminal window.

ALTER TABLE "provoz_provozovna" ADD CONSTRAINT "infrastruktura_id_refs_id_4e49f6

6e" FOREIGN KEY ("infrastruktura_id") REFERENCES "provoz_infrastruktura" ("id")

This will appear as:

15128; 2606 5687308 FK CONSTRAINT public infrastruktura_id_refs_id_4e49f6 6e postgres

in the TOC file and the archiver will fail trying to lookup item ID "6" in the backup.

Fixed the constraint and now everything works.

Last edited 3 years ago by milosh (previous) (diff)

comment:3 Changed 3 years ago by strk

Had you reported this upstream ? It would be nice to make sure it's fixed by newer PostgreSQL versions (if not already fixed), leaving traces here for the next one who would stumble across this bug.

comment:4 Changed 3 years ago by milosh

Filled a PG bug report form right now. Thanks for the reminder.

Note: See TracTickets for help on using tickets.