dokku-psql
dokku-psql copied to clipboard
Get the postgres console output code from restore_sql
For a table that exists:
root@r-pkg:~# echo "select NULL foo from daily LIMIT 1" | dokku psql:restore_sql cranlogs
foo
-----
(1 row)
root@r-pkg:~# echo $?
0
For a table that does not exist:
root@r-pkg:~# echo "select NULL foo from foobar LIMIT 1" | dokku psql:restore_sql cranlogs
ERROR: relation "foobar" does not exist
LINE 1: select NULL foo from foobar LIMIT 1
^
root@r-pkg:~# echo $?
0
It would be useful to check if the query finished properly. I could also try to parse the output, but it would be simpler to just return the exit code of psql
.