summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/pg_locale.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 67299c55ed8..b14c7837938 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -106,6 +106,12 @@ static pg_locale_t default_locale = NULL;
static bool CurrentLocaleConvValid = false;
static bool CurrentLCTimeValid = false;
+static struct pg_locale_struct c_locale = {
+ .deterministic = true,
+ .collate_is_c = true,
+ .ctype_is_c = true,
+};
+
/* Cache for collation-related knowledge */
typedef struct
@@ -1185,6 +1191,13 @@ pg_newlocale_from_collation(Oid collid)
if (collid == DEFAULT_COLLATION_OID)
return default_locale;
+ /*
+ * Some callers expect C_COLLATION_OID to succeed even without catalog
+ * access.
+ */
+ if (collid == C_COLLATION_OID)
+ return &c_locale;
+
if (!OidIsValid(collid))
elog(ERROR, "cache lookup failed for collation %u", collid);