In pg_upgrade, do case-insensitive checks of locale, encoding, and ctype
authorBruce Momjian <bruce@momjian.us>
Tue, 24 May 2011 19:59:00 +0000 (15:59 -0400)
committerBruce Momjian <bruce@momjian.us>
Tue, 24 May 2011 19:59:34 +0000 (15:59 -0400)
because these are often inconsistently capitalized.

contrib/pg_upgrade/check.c

index 2117b7f80d4c0bc8e28e87140037f8c68062357f..60c1fbbf9761110e2f59b1171e68ddd35c110d36 100644 (file)
@@ -333,13 +333,14 @@ static void
 check_locale_and_encoding(ControlData *oldctrl,
                          ControlData *newctrl)
 {
-   if (strcmp(oldctrl->lc_collate, newctrl->lc_collate) != 0)
+   /* These are often defined with inconsistent case, so use pg_strcasecmp(). */
+   if (pg_strcasecmp(oldctrl->lc_collate, newctrl->lc_collate) != 0)
        pg_log(PG_FATAL,
               "old and new cluster lc_collate values do not match\n");
-   if (strcmp(oldctrl->lc_ctype, newctrl->lc_ctype) != 0)
+   if (pg_strcasecmp(oldctrl->lc_ctype, newctrl->lc_ctype) != 0)
        pg_log(PG_FATAL,
               "old and new cluster lc_ctype values do not match\n");
-   if (strcmp(oldctrl->encoding, newctrl->encoding) != 0)
+   if (pg_strcasecmp(oldctrl->encoding, newctrl->encoding) != 0)
        pg_log(PG_FATAL,
               "old and new cluster encoding values do not match\n");
 }