From a80e5ce0c2e9476c9ce7d8a641b6f3e56f5d3735 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 4 Dec 2009 17:17:31 +0100 Subject: [PATCH] More create_postgresql_database.in tweaks --- bacula/src/cats/create_postgresql_database.in | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/bacula/src/cats/create_postgresql_database.in b/bacula/src/cats/create_postgresql_database.in index 5acd0b561d..896c2e6e01 100644 --- a/bacula/src/cats/create_postgresql_database.in +++ b/bacula/src/cats/create_postgresql_database.in @@ -9,8 +9,28 @@ db_name=@db_name@ # # use SQL_ASCII to be able to put any filename into # the database even those created with unusual character sets -ENCODING="ENCODING 'SQL_ASCII'" - + +PSQLVERSION=`$bindir/psql --version | head -n1 | cut -d ' ' -f 3 | cut -d '.' -f 1,2` + +# +# Note, LC_COLLATE and LC_TYPE are needed on 8.4 and beyond, but are +# not implemented in 8.3 or below. +# This must be updated for future versions of PostgreSQL +# +case ${PSQLVERSION} in + "9.*") + ENCODING="ENCODING 'SQL_ASCII' LC_COLLATE 'C' LC_CTYPE 'C'" + ;; + "8.[456789]") + ENCODING="ENCODING 'SQL_ASCII' LC_COLLATE 'C' LC_CTYPE 'C'" + ;; + *) + ENCODING="ENCODING 'SQL_ASCII'" + ;; +esac + + + # # Please note: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # We do not recommend that you use ENCODING 'SQL_UTF8' -- 2.39.5