diff options
author | Bruce Momjian | 2002-10-16 03:24:09 +0000 |
---|---|---|
committer | Bruce Momjian | 2002-10-16 03:24:09 +0000 |
commit | 5d8c67462d93b33b13fe5e45b26002b8e625002c (patch) | |
tree | 5aafb80d4146a135c7cbebc951198b0c48a64e5e /src/bin/scripts/createdb | |
parent | facb72007333d9c0acff0f8d64b36d2c4a262665 (diff) |
Fix script to handle autocommit = 'off' by prepending autocommit 'on' to
the start of the psql commandline. This is better than adding BEGIN/END
because it handles multiple queries well, and allows the return code for
psql to return the proper value.
Diffstat (limited to 'src/bin/scripts/createdb')
-rw-r--r-- | src/bin/scripts/createdb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/scripts/createdb b/src/bin/scripts/createdb index bd68f4c37aa..ad837191200 100644 --- a/src/bin/scripts/createdb +++ b/src/bin/scripts/createdb @@ -12,7 +12,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.25 2002/09/03 21:45:43 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.26 2002/10/16 03:24:09 momjian Exp $ # #------------------------------------------------------------------------- @@ -189,7 +189,7 @@ withstring= [ "$TEMPLATE" ] && withstring="$withstring TEMPLATE = \"$TEMPLATE\"" [ "$withstring" ] && withstring=" WITH$withstring" -${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring" +${PATHNAME}psql $PSQLOPT -d template1 -c "SET autocommit = 'on';CREATE DATABASE \"$dbname\"$withstring" if [ "$?" -ne 0 ]; then echo "$CMDNAME: database creation failed" 1>&2 exit 1 @@ -200,7 +200,7 @@ fi dbcomment=`echo "$dbcomment" | sed "s/'/\\\\\'/g"` -${PATHNAME}psql $PSQLOPT -d "$dbname" -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'" +${PATHNAME}psql $PSQLOPT -d "$dbname" -c "SET autocommit = 'on';COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'" if [ "$?" -ne 0 ]; then echo "$CMDNAME: comment creation failed (database was created)" 1>&2 exit 1 |