Skip to content

Get the postgres console output code from restore_sql #8

@gaborcsardi

Description

@gaborcsardi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions