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. - Mailing list pgsql-bugs

From David G. Johnston
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
Msg-id CAKFQuwbOSnm3b1Zbtbi8uGJ8pb0f=7P_ZnA8L-a4KKnapDrMow@mail.gmail.com
Whole thread Raw
In response to 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.  (tutiluren@tutanota.com)
List 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@tutanota.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.

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16550: Problem with pg_service.conf
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #16550: Problem with pg_service.conf