Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: tutiluren(at)tutanota(dot)com
Cc: Pgsql Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.
Date: 2020-07-25 01:29:49
Message-ID: 20200725012949.GA20763@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2020-Jul-25, tutiluren(at)tutanota(dot)com wrote:

> Although I now have a work-around, which *appears* to work, I'm still utterly confused as to *why* it works. To be clear: why is it that setting the environment variable 'PGCLIENTENCODING' to 'WIN1252' makes the pg_dump succeed when everything, including the database I'm trying to dump, uses UTF8? The only thing not using UTF8 is the "postgres" database (which indeed uses 'WIN1252', certainly not out of my active choice), but that's not involved here... My command connects to my testdb, does it not?

What doesn't use UTF8 is your terminal. So when you enter the accented
letter, you're not actually sending the UTF8 character you think you're
sending, but instead a Win1252 character which matches nothing.

When you use "cmd /U", then your terminal *is* UTF8, so the character is
correct and things work.

You can further test this by setting log_statements=all in
postgresql.conf, sending a reload signal to postgres, and then rerunning
the pg_dump command. When run in the non-UTF8 terminal, the server log
file will show different garbage than when run in the UTF8 terminal.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message tutiluren 2020-07-25 02:21:40 Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.
Previous Message tutiluren 2020-07-25 00:18:15 Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.