mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
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
This commit is contained in:
@@ -268,7 +268,7 @@ hashtext(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *key = PG_GETARG_TEXT_PP(0);
|
||||
Oid collid = PG_GET_COLLATION();
|
||||
pg_locale_t mylocale = 0;
|
||||
pg_locale_t mylocale;
|
||||
Datum result;
|
||||
|
||||
if (!collid)
|
||||
@@ -277,8 +277,7 @@ hashtext(PG_FUNCTION_ARGS)
|
||||
errmsg("could not determine which collation to use for string hashing"),
|
||||
errhint("Use the COLLATE clause to set the collation explicitly.")));
|
||||
|
||||
if (!lc_collate_is_c(collid))
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (pg_locale_deterministic(mylocale))
|
||||
{
|
||||
@@ -324,7 +323,7 @@ hashtextextended(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *key = PG_GETARG_TEXT_PP(0);
|
||||
Oid collid = PG_GET_COLLATION();
|
||||
pg_locale_t mylocale = 0;
|
||||
pg_locale_t mylocale;
|
||||
Datum result;
|
||||
|
||||
if (!collid)
|
||||
@@ -333,8 +332,7 @@ hashtextextended(PG_FUNCTION_ARGS)
|
||||
errmsg("could not determine which collation to use for string hashing"),
|
||||
errhint("Use the COLLATE clause to set the collation explicitly.")));
|
||||
|
||||
if (!lc_collate_is_c(collid))
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (pg_locale_deterministic(mylocale))
|
||||
{
|
||||
|
Reference in New Issue
Block a user