Guard against empty-string results from pg_getlocale.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 May 2002 02:20:26 +0000 (02:20 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 May 2002 02:20:26 +0000 (02:20 +0000)
src/bin/initdb/initdb.sh

index 5afdcd81634744f85c0e60a6ff03fcffd084891c..edba2dc881a3ecfceb10729bb1a99293ab656a24 100644 (file)
@@ -466,11 +466,11 @@ echo
 
 TAB='  '
 
-if test `pg_getlocale CTYPE` = `pg_getlocale COLLATE` \
-   && test `pg_getlocale CTYPE` = `pg_getlocale TIME` \
-   && test `pg_getlocale CTYPE` = `pg_getlocale NUMERIC` \
-   && test `pg_getlocale CTYPE` = `pg_getlocale MONETARY` \
-   && test `pg_getlocale CTYPE` = `pg_getlocale MESSAGES`
+if test x`pg_getlocale CTYPE` = x`pg_getlocale COLLATE` \
+   && test x`pg_getlocale CTYPE` = x`pg_getlocale TIME` \
+   && test x`pg_getlocale CTYPE` = x`pg_getlocale NUMERIC` \
+   && test x`pg_getlocale CTYPE` = x`pg_getlocale MONETARY` \
+   && test x`pg_getlocale CTYPE` = x`pg_getlocale MESSAGES`
 then
     echo "The database cluster will be initialized with locale `pg_getlocale CTYPE`."
 else
@@ -480,7 +480,7 @@ else
 fi
 
 # (Be sure to maintain the correspondence with locale_is_like_safe() in selfuncs.c.)
-if test `pg_getlocale COLLATE` != C && test `pg_getlocale COLLATE` != POSIX; then
+if test x`pg_getlocale COLLATE` != xC && test x`pg_getlocale COLLATE` != xPOSIX; then
     echo "This locale setting will prevent the use of indexes for pattern matching"
     echo "operations.  If that is a concern, rerun $CMDNAME with the collation order"
     echo "set to \"C\".  For more information see the Administrator's Guide."