BUG #16842: pg_dump uses seek calls on pipe files: suggesting adding a flag to disable seek calls

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: tomas(dot)dalebjork(at)gmail(dot)com
Subject: BUG #16842: pg_dump uses seek calls on pipe files: suggesting adding a flag to disable seek calls
Date: 2021-01-28 12:19:52
Message-ID: 16842-381bd64d2f0f68db@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: 16842
Logged by: Tomas Dalebjörk
Email address: tomas(dot)dalebjork(at)gmail(dot)com
PostgreSQL version: 13.0
Operating system: SuSE 15
Description:

pg_dump is trying to identify the type of device used for output.
This is done in a way that it checks that filedescriptor to check if this
supports seek calls etc.
A redirect is a clone of the targeted filedescriptor, which will results in
that the pg_dump utility will enable seek calls.

https://searchcode.com/file/47798353/src/bin/pg_dump/pg_backup_custom.c/

It would be good to add a flag to disable this feature, as some devices does
not support seek calls, for example streaming devices such as a tape
drive.

From Red Hat:
# pg_dump > pgdump.bkp
"That's not a pipe; it's a redirect. The program's stdout (fd=1) will be for
that file, and they can still perform seek operations on it. An fstat(2) on
that file descriptor will show it as a regular file, not a character device
(tty) or a fifo (pipe)."
You could try this instead:
pg_dump | cat > /myfs/testfile.out"

Not sure if this is limited to when --format=custom is used?
It can be worth trying to use pg_dump without the --format=custom option
A restore from pg_dump can't be loaded using pg_restore if --format=custom
is left out (if I recall), but it can be loaded using "psql < dumpfile"

Suggestions for how to avoid seek calls using pg_dump?
Is the seek calls only applicable when --format=custom is used?
Regards Tomas

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2021-01-28 12:31:46 Re: BUG #16583: merge join on tables with different DB collation behind postgres_fdw fails
Previous Message s.p.e 2021-01-28 12:08:21 Postgress 13.x: wrong result for delete with subquery