heroku / cli

Heroku CLI
https://devcenter.heroku.com/articles/heroku-cli
ISC License
851 stars 223 forks source link

pg:pull with --exclude-table-data does not work on Windows #1986

Open rodxavier opened 2 years ago

rodxavier commented 2 years ago

Do you want to request a feature or report a bug?

This is a bug report for Windows. This same command works as expected on Mac.

Heroku Version: heroku/7.60.1 win32-x64 node-v14.19.0 OS: Windows 10 OS Build(19044.1645)

This bug happens due to the generation of the pg_dump child process args. The resulting child process call for windows looks something like:

C:\WINDOWS\system32\cmd.exe /d /s /c "pg_dump --verbose -F c -Z 0 -N _heroku -U <user> -h localhost -p <port> <dbname> --exclude-table-data=table1 --exclude-table-data=table2'

It looks like pg_dump on Windows expects the dbname to be the last part of the command.

What is the current behavior?

Running heroku pg:pull --exclude-table-data "table1;table2" results in an error with pg_dump.

pg_dump: error too many command-line arguments first is "--exclude-table-data=table1"

What is the expected behavior?

Expected behaviour is to pull the database without data from the specified tables

shaunkh commented 2 years ago

@rodxavier any idea on how you solved this?

rodxavier commented 2 years ago

@shaunkh, please look at linked PR.

sbosio commented 3 months ago

This fix never made it to the CLI, it shows with a merged PR linked.

I'm adding a work item to our backlog to fix this bug.

sbosio commented 3 months ago

GUS Work Item (Heroku internal)