linkend="app-initlocation">.
+ Specifies the template database from which to build this database.
+ SQL command
+ endterm="SQL-CREATEDATABASE-title">, which see for more information
+ about them.
The comment/description for the database could not be created.
- the database itself will have been created already. You can use the
+ The database itself will have been created already. You can use the
SQL command
COMMENT ON DATABASE to
create the comment later on.
the
Postgres interactive terminal
. Thus, there is nothing
special about creating databases via this or other methods. This means
- that the
psql must be found by the script and that
- a database server is running at the targeted host. Also, any default
+ that the
psql program must be found by the script and that
+ a database server must be running at the targeted port. Also, any default
settings and environment variables available to
psql
- and the
libpq front-end library
do apply.
+ and the
libpq front-end library
will apply.
# This program runs psql with the "-c" option to create
# the requested database.
#
-# Copyright (c) 1994, Regents of the University of California
+# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.13 2001/01/21 05:16:45 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.14 2001/02/18 17:53:54 tgl Exp $
#
#-------------------------------------------------------------------------
PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
MB=
+TEMPLATE=
PSQLOPT=
dbname=
dbcomment=
--location=*)
dbpath=`echo "$1" | sed 's/^--location=//'`
;;
+ --template|-T)
+ TEMPLATE="$2"
+ shift;;
+ -T*)
+ TEMPLATE=`echo "$1" | sed 's/^-T//'`
+ ;;
+ --template=*)
+ TEMPLATE=`echo "$1" | sed 's/^--template=//'`
+ ;;
--encoding|-E)
MB="$2"
shift;;
echo
echo "Options:"
echo " -D, --location=PATH Alternative place to store the database"
+ echo " -T, --template=TEMPLATE Template database to copy"
echo " -E, --encoding=ENCODING Multibyte encoding for the database"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
# escape the quotes
dbpath=`echo "$dbpath" | sed "s/'/\\\\\'/g"`
dbname=`echo "$dbname" | sed 's/\"/\\\"/g'`
+TEMPLATE=`echo "$TEMPLATE" | sed 's/\"/\"\"/g'`
withstring=
[ "$dbpath" ] && withstring="$withstring LOCATION = '$dbpath'"
[ "$MB" ] && withstring="$withstring ENCODING = '$MB'"
+[ "$TEMPLATE" ] && withstring="$withstring TEMPLATE = \"$TEMPLATE\""
[ "$withstring" ] && withstring=" WITH$withstring"
${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
#! /bin/sh
-# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.18 2001/01/19 23:43:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.19 2001/02/18 17:53:55 tgl Exp $
me=`basename $0`
: ${TMPDIR=/tmp}
# ----------
# Create the regression database
+# We use template0 so that any installation-local cruft in template1
+# will not mess up the tests.
# ----------
message "creating database \"$dbname\""
-"$bindir/createdb" $encoding_opt $psql_options "$dbname"
+"$bindir/createdb" $encoding_opt $psql_options --template template0 "$dbname"
if [ $? -ne 0 ]; then
echo "$me: createdb failed"
(exit 2); exit