From e9931bfb7515b253cc26ff495ee917acff8995d0 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Mon, 5 Aug 2024 18:15:57 -0700 Subject: Remove support for null pg_locale_t most places. Previously, passing NULL for pg_locale_t meant "use the libc provider and the server environment". Now that the database collation is represented as a proper pg_locale_t (not dependent on setlocale()), remove special cases for NULL. Leave wchar2char() and char2wchar() unchanged for now, because the callers don't always have a libc-based pg_locale_t available. Discussion: https://postgr.es/m/cfd9eb85-c52a-4ec9-a90e-a5e4de56e57d@eisentraut.org Reviewed-by: Peter Eisentraut, Andreas Karlsson --- src/backend/utils/adt/varchar.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/backend/utils/adt/varchar.c') diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 1ba5f9d9f6c..0c219dcc779 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -999,7 +999,7 @@ hashbpchar(PG_FUNCTION_ARGS) Oid collid = PG_GET_COLLATION(); char *keydata; int keylen; - pg_locale_t mylocale = 0; + pg_locale_t mylocale; Datum result; if (!collid) @@ -1011,8 +1011,7 @@ hashbpchar(PG_FUNCTION_ARGS) keydata = VARDATA_ANY(key); keylen = bcTruelen(key); - if (!lc_collate_is_c(collid)) - mylocale = pg_newlocale_from_collation(collid); + mylocale = pg_newlocale_from_collation(collid); if (pg_locale_deterministic(mylocale)) { @@ -1056,7 +1055,7 @@ hashbpcharextended(PG_FUNCTION_ARGS) Oid collid = PG_GET_COLLATION(); char *keydata; int keylen; - pg_locale_t mylocale = 0; + pg_locale_t mylocale; Datum result; if (!collid) @@ -1068,8 +1067,7 @@ hashbpcharextended(PG_FUNCTION_ARGS) keydata = VARDATA_ANY(key); keylen = bcTruelen(key); - if (!lc_collate_is_c(collid)) - mylocale = pg_newlocale_from_collation(collid); + mylocale = pg_newlocale_from_collation(collid); if (pg_locale_deterministic(mylocale)) { -- cgit v1.2.3