BUG #16732: pg_dump creates broken backups

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zsolt(dot)ero(at)gmail(dot)com
Subject: BUG #16732: pg_dump creates broken backups
Date: 2020-11-20 01:13:12
Message-ID: 16732-f34c8da8c206c290@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16732
Logged by: Zsolt Ero
Email address: zsolt(dot)ero(at)gmail(dot)com
PostgreSQL version: 12.4
Operating system: Ubuntu 16.04
Description:

On a production server (12.4) backups are created by the following
command:
pg_dump --dbname=app --format=custom --file=$BACKUP_DIR/app.dump

Then on any other machine (can be the same server, can be a my macOS laptop
running 12.5), this command always fails (or it'd fail with
--single-transaction):
pg_restore --dbname=maphub_web --format=custom $BACKUP_FILE

The error is always:
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 2976; 0 63529 TABLE DATA map_versions app
pg_restore: error: COPY failed for table "map_versions": ERROR: insert or
update on table "map_versions" violates foreign key constraint
"fk_map_versions_map_id_maps"
DETAIL: Key (map_id)=(112664) is not present in table "maps".

The target database is cleaned with dropdb + createdb before pg_restore. I
compared the backups by md5, the file is not-corrupt.

This is quite shocking in a way, meaning that right now I couldn't restore
my prod server in case I'd need to.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Nail Carpenter 2020-11-20 01:50:46 Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted
Previous Message David G. Johnston 2020-11-19 23:22:10 Re: vacuumdb -Z can't find function declared on functional index with inline sql function