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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "tutiluren(at)tutanota(dot)com" <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-24 06:14:08
Message-ID: CAKFQuwZwo2Lc3tzVagy-UwqG9YkPjiWtDfM9w4+6zupiY-oTbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thursday, July 23, 2020, <tutiluren(at)tutanota(dot)com> wrote:

> After taking a longer break from my problem, I have now made a fresh,
> clean, scientifically conducted experiment in order to truly get to the
> bottom of this annoying problem once and for all.
>
> First, I set cmd.exe to use Unicode, just to be sure:
>
> C:\pg_dump_test>chcp 65001
> Active code page: 65001
>
> pg_dump: creating CONSTRAINT "Test schäma.Test täble Test täble_pkey"
>
> = WORKS. The dump was successful. (In spite of weird output chars.)
>
> C:\pg_dump_test>pg_dump --format plain --verbose --file "testdump.txt"
> --exclude-table-data="Test schäma.Test täble" --host="localhost"
> --port="5432" --username="postgres" --dbname="test"
> pg_dump: last built-in OID is 16383
> pg_dump: [archiver (db)] query failed: ERROR: invalid byte sequence for
> encoding "UTF8": 0xe4 0x62 0x6c
> pg_dump: [archiver (db)] query was: SELECT c.oid
> FROM pg_catalog.pg_class c
> LEFT JOIN pg_catalog.pg_namespace n
> ON n.oid OPERATOR(pg_catalog.=) c.relnamespace
> WHERE c.relkind OPERATOR(pg_catalog.=) ANY
> (array['r', 'S', 'v', 'm', 'f', 'p'])
> AND c.relname OPERATOR(pg_catalog.~) '^(test täble)$'
> AND n.nspname OPERATOR(pg_catalog.~) '^(test schäma)$'
>
> = FAILED. The dump was aborted with these nonsensical errors.
>
> Finally, I tried the same command again like this:
>
>
> I looked everywhere for some kind of "client-encoding" option in the
> pg_dump manual, but there is no such thing. The only thing I can think of
> is that the client's encoding (that is, pg_dump) is for some reason not set
> to "UTF8" even though that's the encoding of the "test" database which I'm
> connecting to.
>

The main thing here is this isn’t properly considered a bug in pg_dump but
rather with most likely any client command run in the cmd.exe shell. Or
even more generally with the data flowing through the pipeline, which is
libpq. Thus what you want is a libpq option.

https://www.postgresql.org/docs/12/libpq-envars.html

And here is an old, similar, bug report, with an apparent work-around (or
solution depending on details that as an English Linux user I am not in a
position to judge).

https://www.postgresql.org/message-id/1318589950754-4902202.post%40n5.nabble.com

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2020-07-24 10:30:35 Re: pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.
Previous Message tutiluren 2020-07-24 03:07:21 pg_dump seems to be broken in regards to the "--exclude-table-data" option on Windows.