]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Make initdb print a message about which locale it is about to use.
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 9 May 2002 13:30:24 +0000 (13:30 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 9 May 2002 13:30:24 +0000 (13:30 +0000)
Re-add warning if the locale prevents LIKE-optimization.  Done within
initdb now.

doc/src/sgml/runtime.sgml
src/backend/access/transam/xlog.c
src/backend/utils/adt/selfuncs.c
src/bin/initdb/initdb.sh

index 5332808fe779af8a7142af3b086e91e2c98acb36..70131be3a27a856f85f8084a6e775a28bf540757 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.114 2002/04/26 01:24:08 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.115 2002/05/09 13:30:24 petere Exp $
 -->
 
 <Chapter Id="runtime">
@@ -145,11 +145,10 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
    linkend="locale">.  One surprise you might encounter while running
    <command>initdb</command> is a notice similar to this:
 <screen>
-WARNING:  Initializing database with en_US collation order.
-        This locale setting will prevent use of index optimization for
-        LIKE and regexp searches.  If you are concerned about speed of
-        such queries, you may wish to set LC_COLLATE to "C" and
-        re-initdb.  For more information see the Administrator's Guide.
+The database cluster will be initialized with locale de_DE.
+This locale setting will prevent the use of indexes for pattern matching
+operations.  If that is a concern, rerun initdb with the collation order
+set to "C".  For more information see the Administrator's Guide.
 </screen>
    This is intended to warn you that the currently selected locale
    will cause indexes to be sorted in an order that prevents them from
index a6a51f7f604ad40e31ca9d3f250f0d34e8780511..eca4a5de5f83e3cba453d456112c109dd20a187e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.93 2002/04/24 01:54:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.94 2002/05/09 13:30:24 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,7 +39,6 @@
 #include "storage/spin.h"
 #include "utils/builtins.h"
 #include "utils/relcache.h"
-#include "utils/selfuncs.h"
 #include "miscadmin.h"
 
 
@@ -2108,19 +2107,6 @@ WriteControlFile(void)
                elog(PANIC, "invalid LC_CTYPE setting");
        StrNCpy(ControlFile->lc_ctype, localeptr, LOCALE_NAME_BUFLEN);
 
-       /*
-        * Issue warning WARNING if initdb'ing in a locale that will not permit
-        * LIKE index optimization.  This is not a clean place to do it, but I
-        * don't see a better place either...
-        */
-       if (!locale_is_like_safe())
-               elog(WARNING, "Initializing database with %s collation order."
-                        "\n\tThis locale setting will prevent use of index optimization for"
-                        "\n\tLIKE and regexp searches.  If you are concerned about speed of"
-                        "\n\tsuch queries, you may wish to set LC_COLLATE to \"C\" and"
-                        "\n\tre-initdb.  For more information see the Administrator's Guide.",
-                        ControlFile->lc_collate);
-
        /* Contents are protected with a CRC */
        INIT_CRC64(ControlFile->crc);
        COMP_CRC64(ControlFile->crc,
index 8294612e137786eae8811f9fa5ebddb49627ada3..7ba1fd55875552cf8b29b9ab7902551de25d8694 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.110 2002/04/25 02:56:55 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.111 2002/05/09 13:30:24 petere Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -3189,6 +3189,8 @@ pattern_selectivity(char *patt, Pattern_Type ptype)
  * could be different from lc_collate_is_c(), but in a different
  * theory, non-C locales are completely unpredicable so it's unlikely
  * to happen.)
+ *
+ * Be sure to maintain the correspondence with the code in initdb.
  */
 bool
 locale_is_like_safe(void)
index 9a6b78217b784273b11285a99caa8f861bb4a1b5..0405b316d7576c7cc7678cbc2cb7a55b1d8fed7c 100644 (file)
@@ -27,7 +27,7 @@
 # Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.152 2002/04/27 21:24:34 tgl Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.153 2002/05/09 13:30:24 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -464,6 +464,30 @@ echo "The files belonging to this database system will be owned by user \"$Effec
 echo "This user must also own the server process."
 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`
+then
+    echo "The database cluster will be initialized with locale `pg_getlocale CTYPE`."
+else
+    echo "The database cluster will be initialized with locales:"
+    echo "    COLLATE:  `pg_getlocale COLLATE`${TAB}CTYPE:   `pg_getlocale CTYPE`${TAB}MESSAGES: `pg_getlocale MESSAGES`"
+    echo "    MONETARY: `pg_getlocale MONETARY`${TAB}NUMERIC: `pg_getlocale NUMERIC`${TAB}TIME:     `pg_getlocale TIME`"
+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
+    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."
+fi
+echo
+
+
 ##########################################################################
 #
 # CREATE DATABASE DIRECTORY