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

From Juan José Santamaría Flecha
Subject Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.
Date
Msg-id CAC+AXB0Xsm8kuXKn4tc1R_40fW8rYR_dhb1AFKjeh84JO9jKeA@mail.gmail.com
Whole thread Raw
In response to Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs

On Wed, Jul 29, 2020 at 4:10 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Oleksandr Shulgin <oleksandr.shulgin@zalando.de> writes:
> Didn't you mention that once you could overcome the runtime errors you
> still have seen some unexpected output from pg_dump?  A script that one can
> download and run on their (Windows) system would help to confirm the
> problem (if it does reproduce on others' systems) and speed up diagnosys
> and a fix, if required.

My understanding of what's happening here (admittedly, I've not been
paying really close attention) is that some component is misprocessing
non-ASCII data as it's being typed into the pg_dump shell command.
That being the case, I'm not sure that a pre-written shell script could
reproduce the issue accurately.  A script to create the initial database
contents would surely be helpful, but the steps after that might need to
be more like "type this into the terminal, and then you will get X instead
of Y".

On a Windows "char* argv[]" uses the system default Windows ANSI code page (CP_ACP), this can only be changed through the system Regional settings. The "chcp" command changes the code page of the printed characters on CMD.

Please find attached a simple test program: "test_argv.c". The output for this program is:

C:\test>chcp 65001
Active code page: 65001

C:\test>test_argv Hëllö
Hëllö
0x48C3AB6C6CC3B6
Hll
0x48EB6C6CF6
C:\test>chcp 1252
Active code page: 1252

C:\test>test_argv Hëllö
Hëllö
0x48C3AB6C6CC3B6
Hëllö
0x48EB6C6CF6

To match this behaviour PGCLIENTENCODING should match the Windows system ANSI encoding.

Regards,

Juan José Santamaría Flecha
Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.
Next
From: PG Bug reporting form
Date:
Subject: BUG #16560: Strange behavior with polygon and NaN