Re: pg_dump's "--exclude-table" and "--exclude-table-data" options are ignored and/or cause the dump to fail entirely unless both the schema and table name use 1950s-era identifiers.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: tutiluren(at)tutanota(dot)com
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump's "--exclude-table" and "--exclude-table-data" options are ignored and/or cause the dump to fail entirely unless both the schema and table name use 1950s-era identifiers.
Date: 2020-07-21 17:53:35
Message-ID: CAKFQuwbOSnm3b1Zbtbi8uGJ8pb0f=7P_ZnA8L-a4KKnapDrMow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

You need to reply-all so that the list as a whole can contribute.

On Tue, Jul 21, 2020 at 10:36 AM <tutiluren(at)tutanota(dot)com> wrote:

>
> Not sure about encoding dynamics but your issue is likely with writing
> shell commands. Instead of trying to write a full pg_dump command I
> suggest trying to set the value of an environment variable to the
> double-quoted value you want (checking it with echo) and then just
> supplying that variable with the pg_dump command.
>
> This sounded promising at first, and I have been forced to do something
> similar before to provide the password with "PGPASSWORD" as it wouldn't let
> me enter this on the command line as an argument, but unless I
> misunderstand you, my:
>
> --exclude-table-data=%TEMPTESTFORPG%
>
> ... isn't turned into the value for "TEMPTESTFORPG",
>

ok, what is it turned into? Though looking at it now if it is simple text
substitution it may not work the way I was hoping...I would need to
experiment. Sticking with just the original command in the shell may
indeed be easier - though practicing with "echo" instead "pg_dump" is still
a good idea, quicker iterations.

which I set with this in PHP:
>
> putenv('TEMPTESTFORPG="Schema name"."Table name"');
>
> I also tried with:
>
> --exclude-table-data=' . getenv('TEMPTESTFORPG')
>
> .... but it just has the same stupid result with pg_dump either dumping
> the nonsensical errors or executing the command but ignoring my "exclude
> rule" (and thus dumping the table's data).
>
>
You should probably remove PHP from the equation as well - but that fact
you are not doing this in a shell but instead through a separate
programming language is information that is helpful to provide upfront. It
should actually be easier to do this in a language that provides a decent
abstraction of the system's process since you can just stick stuff in
normal variables and let the language take care of escaping and the like.

And keep in mind that the rule is a pattern matching expression and not a
simple literal.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2020-07-21 18:07:23 Re: BUG #16550: Problem with pg_service.conf
Previous Message PG Bug reporting form 2020-07-21 16:20:27 BUG #16550: Problem with pg_service.conf