Skip to content

Commit

Permalink
fix: set ON_ERROR_STOP=1 for psql, so calling scripts get an exit status
Browse files Browse the repository at this point in the history
Currently, using `postgres:connect` with a script passed in through stdin, there is no way to know if the script failed or not.

This change aligns the behavior with https://github.com/docker-library/postgres/blob/eaa1c35769621a6bb1e499073a5812ba478c7688/docker-entrypoint.sh#L196 which returns an exit status.
  • Loading branch information
erickedji authored Sep 24, 2024
1 parent 81ff145 commit 6577443
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ service_connect() {
local SERVICE_TTY_OPTS
has_tty && SERVICE_TTY_OPTS="-t"

"$DOCKER_BIN" container exec --env=LANG=C.UTF-8 --env=LC_ALL=C.UTF-8 -i $SERVICE_TTY_OPTS "$SERVICE_NAME" psql -h localhost -U postgres "$DATABASE_NAME"
"$DOCKER_BIN" container exec --env=LANG=C.UTF-8 --env=LC_ALL=C.UTF-8 -i $SERVICE_TTY_OPTS "$SERVICE_NAME" psql -v ON_ERROR_STOP=1 -h localhost -U postgres "$DATABASE_NAME"
}

service_create() {
Expand Down

0 comments on commit 6577443

Please sign in to comment.