heroku / heroku-pg

this code is now in https://github.com/heroku/cli
ISC License
15 stars 17 forks source link

`heroku pg:pull` produces lots of output to stderr #168

Open jdx opened 6 years ago

jdx commented 6 years ago

From https://github.com/heroku/cli/issues/435:

$ heroku pg:pull DATABASE_URL db --app app > /dev/null
pg_restore: creating CONSTRAINT [..]
pg_restore: setting owner and privileges for FK CONSTRAINT [..]
[hundreds of lines]

$ heroku pg:pull DATABASE_URL db --app app > /dev/null 2>&1
$

Setting > /dev/null does nothing, but > /dev/null 2>&1 works to suppress output. But I don't really want to suppress potential errors. Am I doing anything wrong?

msakrejda commented 6 years ago

So pg:pull works by invoking the standard Postgres tools pg_dump and pg_restore. Output from the former is piped into the latter, so stdout for pg_dump is already taken. We could potentially redirect stderr from the pipeline to stdout, but that goes against the convention of these tools.

Maybe the right solution is to add a --quiet flag to omit the --verbose flag we currently pass to pg_dump and pg_restore? I don't think we should change the default, since most schemas are fairly small and the informational messages are not an issue.