aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pg_locale.c
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2024-09-04 12:30:14 -0700
committerJeff Davis <jdavis@postgresql.org>2024-09-04 14:35:25 -0700
commit06421b08436414b42cd169501005f15adee986f1 (patch)
tree2cf8e527daaf21dd9057f0d2a3a648e35367ff96 /src/backend/utils/adt/pg_locale.c
parent83eb481d527b541e2ef2a1b14ab2c56b2ccf362b (diff)
downloadpostgresql-06421b08436414b42cd169501005f15adee986f1.tar.gz
postgresql-06421b08436414b42cd169501005f15adee986f1.zip
Remove lc_collate_is_c().
Instead just look up the collation and check collate_is_c field. Author: Andreas Karlsson Discussion: https://postgr.es/m/60929555-4709-40a7-b136-bcb44cff5a3c@proxel.se
Diffstat (limited to 'src/backend/utils/adt/pg_locale.c')
-rw-r--r--src/backend/utils/adt/pg_locale.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index d82e816230f..cb9f1b4f78e 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -1266,33 +1266,6 @@ lookup_collation_cache(Oid collation)
return cache_entry;
}
-
-/*
- * Detect whether collation's LC_COLLATE property is C
- */
-bool
-lc_collate_is_c(Oid collation)
-{
- /*
- * If we're asked about "collation 0", return false, so that the code will
- * go into the non-C path and report that the collation is bogus.
- */
- if (!OidIsValid(collation))
- return false;
-
- /*
- * If we're asked about the built-in C/POSIX collations, we know that.
- */
- if (collation == C_COLLATION_OID ||
- collation == POSIX_COLLATION_OID)
- return true;
-
- /*
- * Otherwise, we have to consult pg_collation, but we cache that.
- */
- return pg_newlocale_from_collation(collation)->collate_is_c;
-}
-
/*
* Detect whether collation's LC_CTYPE property is C
*/
@@ -1571,12 +1544,12 @@ pg_newlocale_from_collation(Oid collid)
{
collation_cache_entry *cache_entry;
- /* Callers must pass a valid OID */
- Assert(OidIsValid(collid));
-
if (collid == DEFAULT_COLLATION_OID)
return &default_locale;
+ if (!OidIsValid(collid))
+ elog(ERROR, "cache lookup failed for collation %u", collid);
+
if (last_collation_cache_oid == collid)
return last_collation_cache_locale;