Subject: question on plain pg_dump file usage

From: "Zwettler Markus (OIZ)" <[email-masked]>
Date: Tue, 17 Sep 2024 12:22:14 +0000

I have to do an out-of-place Postgres migration from PG12 to PG16 using:

pg_dump -F p -f dump.sql ...
sed -i "s/old_name/new_name/g"
psql -f dump.sql ...

Both databases are on UTF-8.

I wonder if there could be character set conversion errors here, as the data is temporarily written to a plain text file.

Thanks, Markus

---

From: Greg Sabino Mullane <[email-masked]>
Date: Tue, 17 Sep 2024 09:18:02 -0400

On Tue, Sep 17, 2024 at 8:22 AM Zwettler Markus (OIZ) <
[email-masked]> wrote:

> pg_dump -F p -f dump.sql …
>
> psql -f dump.sql …

Why not rename afterwards? Just "pg_dump mydb | psql -h newhost -f -" and
rename things via ALTER. Certainly much safer than a global replace via sed.

Cheers,
Greg

---

From: "Zwettler Markus (OIZ)" <[email-masked]>
Date: Tue, 17 Sep 2024 13:27:42 +0000

Von: Zwettler Markus (OIZ) <[email-masked]>
Gesendet: Dienstag, 17. September 2024 14:22
An: PG-General Mailing List <[email-masked]>
Betreff: question on plain pg_dump file usage

Thanks, Markus

I found that the tempory plain text file is also encoded in UTF-8.

There should not be any problem so. Agreed?

$ file -bi dump.sql
text/plain; charset=utf-8