Re: pg_restore fails on extracted tar archives with large objects

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_restore fails on extracted tar archives with large objects
Date: 2026-11-20 08:04:19
Message-ID: av//A7/fudljFB52@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Nov 19, 2026 at 03:23:32PM -0600, Nathan Bossart wrote:
> 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.

It looks like _PrepParallelRestore() is affected by the same issue. The stat()
fails, leaving the BLOBS entry’s dataLength at zero, so the parallel scheduler
cannot use the intended size estimate. Should this use the same filename
construction as _LoadLOs()?

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Michael Paquier 2026-11-20 08:00:49 Re: Checkpoints stuck after a failed bulk write inside a savepoint