From 2598b76bf2bc78af4c65ffab4736c7b49205fc7a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 22 Oct 2022 09:41:38 +0200 Subject: [PATCH] psql: Fix exit status when query is canceled Because of a small thinko in 7844c9918a43b494adde3575891d217a37062378, psql -c would exit successfully when a query is canceled. Fix this so that it exits with a nonzero status, just like for all other errors. --- src/bin/psql/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 4f310a8019..864f195992 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1114,7 +1114,7 @@ SendQuery(const char *query) pset.crosstab_flag || !is_select_command(query)) { /* Default fetch-it-all-and-print mode */ - OK = (ExecQueryAndProcessResults(query, &elapsed_msec, &svpt_gone, false, NULL, NULL) >= 0); + OK = (ExecQueryAndProcessResults(query, &elapsed_msec, &svpt_gone, false, NULL, NULL) > 0); } else {