v12 and pg_restore -f-

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: v12 and pg_restore -f-
Date: 2019-10-06 19:08:39
Message-ID: 20191006190839.GE18030@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

This is a "heads up" for others upgrading to v12. I found a solution for our
use case, but it'd be easy to miss this, even if you read the release notes.

I saw this and updated our scripts with pg_restore -f-
https://www.postgresql.org/docs/12/release-12.html
|In pg_restore, require specification of -f - to send the dump contents to standard output (Euler Taveira)
|Previously, this happened by default if no destination was specified, but that was deemed to be unfriendly.

What I didn't realize at first is that -f- has no special meaning in v11 - it
just writes a file called ./- And it's considered untennable to change
behavior of v11.

In our use, that was being piped to sed, which then saw nothing on its stdin
and just exits.. I changed our script to use pg_restore -f /dev/stdout, which
seems to be portable across postgres versions for the OS distribution we're
running. Unfortunately, I can't think of anything portable across *OS* or
useful to include in documentation. In the worst case, someone might need to
call pg_restore differently based on its version.

Justin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-10-06 20:43:13 Re: v12 and pg_restore -f-
Previous Message Miles Elam 2019-10-05 20:27:38 Re: Event Triggers and Dropping Objects

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2019-10-06 19:23:13 Re: How to retain lesser paths at add_path()?
Previous Message Tom Lane 2019-10-06 17:17:37 Missed check for too-many-children in bgworker spawning