pg_restore fails on extracted tar archives with large objects

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_restore fails on extracted tar archives with large objects
Date: 2026-11-19 21:23:32
Message-ID: av9o1Fi3PQ-jqmGO@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The following commands produce an error:

createdb src
createdb dst
psql src -c "select lo_from_bytea(1, '\xff')"
pg_dump -Ft -f d.tar src
mkdir ex
tar xf d.tar -C ex
pg_restore -Fd -d dst ex

pg_restore: error: could not open large object TOC file "ex/2966.dat" for input: No such file or directory

This is because the tar format puts NNN.dat instead of blobs_NNN.toc into
the BLOBS TOC entry. That was harmless until commit a45c78e328 (v17)
taught the directory format's restore code to use the file name in the TOC
entry. Commit 166b4f4560 fixed a similar problem for directory-format
dumps made by versions before v12.

The attached patch fixes it by constructing the file name instead of using
the one in the TOC entry. Given the lack of reports, I'm guessing few
users are using extracted tar archives like this, or even using the tar
format at all. IMHO we should seriously consider putting the tar format on
a path to deprecation, but I'll save that discussion for later.

--
nathan

Attachment Content-Type Size
v1-0001-pg_restore-Fix-incompatibility-with-extracted-tar.patch text/plain 2.3 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message Peter Geoghegan 2026-11-19 21:10:48 Re: [PATCH v2] Fix SP-GiST index-only scans that return only INCLUDE columns