[Lada-commits] [PATCH 1 of 2] Stop on error any execution of SQL via psql in DB setup

Wald Commits scm-commit at wald.intevation.org
Fri Mar 17 13:01:09 CET 2017


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1489751543 -3600
# Node ID b5ab25b7ac2c4f586ae0493063ef9c63210183c5
# Parent  c5721e624c0e9d2dee899a37d7c46471938fee0d
Stop on error any execution of SQL via psql in DB setup.

Though this duplicates respective \set commands in many scripts,
I leave them there because they might help in debugging anyhow.
Hopefully this change will improve prevention of adding broken SQL
like currently audit.sql.

diff -r c5721e624c0e -r b5ab25b7ac2c db_schema/setup-db.sh
--- a/db_schema/setup-db.sh	Wed Mar 08 15:59:47 2017 +0100
+++ b/db_schema/setup-db.sh	Fri Mar 17 12:52:23 2017 +0100
@@ -32,6 +32,9 @@
 DB_NAME=${3:-$ROLE_NAME}
 echo "DB_NAME = $DB_NAME"
 
+# Stop on error any execution of SQL via psql
+DB_CONNECT_STRING="-v ON_ERROR_STOP=on "
+
 # if variable DB_SRV and otional DB_PORT is set a remote database connection will be used
 if [ -n "$DB_SRV" ] ; then DB_CONNECT_STRING="-h $DB_SRV" ; fi
 if [ -n "$DB_SRV" -a -n "$DB_PORT"  ] ; then


More information about the Lada-commits mailing list