+ res = PQexec(conn, "SHOW lc_messages");
+ status_code = PQresultStatus(res);
+ if (status_code != PGRES_TUPLES_OK && status_code != PGRES_SINGLE_TUPLE) {
+ fprintf(stderr, "Failed determining database locale: %s\n", PQerrorMessage(conn));
+ exit(EXIT_FAILURE);
+ }
+ num_rows = PQntuples(res);
+ if (num_rows > 0)
+ {
+ result_string = PQgetvalue(res, 0, 0);
+ if (result_string && (strlen(result_string) > 0) && (strcasecmp(result_string, "C") != 0))
+ {
+ // non-default locale if the result exists, is non-empty, and is not "C"
+ db_has_locale = 1;
+ }
+ }
+