From: Ian Jackson Date: Tue, 27 Apr 2021 17:43:23 +0000 (+0000) Subject: mg-schema-test-database: posgtres compat: psql transactions X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=732a0a5762956e81236de3e4f66405157b53354e;p=osstest.git mg-schema-test-database: posgtres compat: psql transactions Now (postgresql 11): * psql transaction behaviour has changed so that now we want to use the -1 option. This obviates a few BEGIN and COMMITs. * SET implicitly starts a transaction and DROP and CREATE DATABASE aren't transactional and now complain if they are run in a transaction. So we must add COMMIT after SET. Signed-off-by: Ian Jackson --- diff --git a/mg-schema-create b/mg-schema-create index 9bb3040..3a344db 100755 --- a/mg-schema-create +++ b/mg-schema-create @@ -89,7 +89,7 @@ fi $progress "Populating database..." -$(get_psql_cmd) $quietopt -f schema/initial.sql +$(get_psql_cmd) $quietopt -1 -f schema/initial.sql if $do_updates; then ./mg-schema-update $quietopt apply-all "${updates[@]}" diff --git a/mg-schema-test-database b/mg-schema-test-database index dab536c..e69b988 100755 --- a/mg-schema-test-database +++ b/mg-schema-test-database @@ -132,7 +132,7 @@ psql_query () { } psql_do_cmd () { - echo "$(get_psql_cmd) ${OSSTEST_DEBUG:+-e -a}" + echo "$(get_psql_cmd) ${OSSTEST_DEBUG:+-e -a}" -1 } psql_do () { @@ -411,7 +411,9 @@ END #---------- create test db ---------- psql_do <>$t.import <