]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/create_postgresql_database.in
Apply Postgres 8.4 SQL_ASCII fix
[bacula/bacula] / bacula / src / cats / create_postgresql_database.in
1 #!/bin/sh
2 #
3 # shell script to create Bacula database(s)
4 #
5
6 bindir=@SQL_BINDIR@
7 db_name=@db_name@
8
9 # use SQL_ASCII to be able to put any filename into
10 #  the database even those created with unusual character sets
11 ENCODING="ENCODING 'SQL_ASCII'"
12  
13 # use UTF8 if you are using standard Unix/Linux LANG specifications
14 #  that use UTF8 -- this is normally the default and *should* be
15 #  your standard.  Bacula works correctly *only* with correct UTF8.
16 #
17 #  Note, with this encoding, if you have any "weird" filenames on
18 #  your system (names generated from Win32 or Mac OS), you may
19 #  get Bacula batch insert failures.
20 #
21 #ENCODING="ENCODING 'UTF8'"
22      
23 #
24 # KES: Note: the CREATE DATABASE, probably should be
25 #   CREATE DATABASE ${db_name} $ENCODING TEMPLATE template0
26 #
27 if $bindir/psql -f - -d template1 $* <<END-OF-DATA
28 CREATE DATABASE ${db_name} $ENCODING TEMPLATE template0;
29 ALTER DATABASE ${db_name} SET datestyle TO 'ISO, YMD';
30 END-OF-DATA
31 then
32    echo "Creation of ${db_name} database succeeded."
33 else
34    echo "Creation of ${db_name} database failed."
35 fi
36 exit 0