mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +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:
@@ -1217,12 +1217,11 @@ text_position_setup(text *t1, text *t2, Oid collid, TextPositionState *state)
|
||||
{
|
||||
int len1 = VARSIZE_ANY_EXHDR(t1);
|
||||
int len2 = VARSIZE_ANY_EXHDR(t2);
|
||||
pg_locale_t mylocale = 0;
|
||||
pg_locale_t mylocale;
|
||||
|
||||
check_collation_set(collid);
|
||||
|
||||
if (!lc_collate_is_c(collid))
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (!pg_locale_deterministic(mylocale))
|
||||
ereport(ERROR,
|
||||
@@ -1619,18 +1618,14 @@ Datum
|
||||
texteq(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid collid = PG_GET_COLLATION();
|
||||
bool locale_is_c = false;
|
||||
pg_locale_t mylocale = 0;
|
||||
bool result;
|
||||
|
||||
check_collation_set(collid);
|
||||
|
||||
if (lc_collate_is_c(collid))
|
||||
locale_is_c = true;
|
||||
else
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (locale_is_c || pg_locale_deterministic(mylocale))
|
||||
if (pg_locale_deterministic(mylocale))
|
||||
{
|
||||
Datum arg1 = PG_GETARG_DATUM(0);
|
||||
Datum arg2 = PG_GETARG_DATUM(1);
|
||||
@@ -1678,18 +1673,14 @@ Datum
|
||||
textne(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid collid = PG_GET_COLLATION();
|
||||
bool locale_is_c = false;
|
||||
pg_locale_t mylocale = 0;
|
||||
pg_locale_t mylocale;
|
||||
bool result;
|
||||
|
||||
check_collation_set(collid);
|
||||
|
||||
if (lc_collate_is_c(collid))
|
||||
locale_is_c = true;
|
||||
else
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (locale_is_c || pg_locale_deterministic(mylocale))
|
||||
if (pg_locale_deterministic(mylocale))
|
||||
{
|
||||
Datum arg1 = PG_GETARG_DATUM(0);
|
||||
Datum arg2 = PG_GETARG_DATUM(1);
|
||||
@@ -1793,15 +1784,14 @@ text_starts_with(PG_FUNCTION_ARGS)
|
||||
Datum arg1 = PG_GETARG_DATUM(0);
|
||||
Datum arg2 = PG_GETARG_DATUM(1);
|
||||
Oid collid = PG_GET_COLLATION();
|
||||
pg_locale_t mylocale = 0;
|
||||
pg_locale_t mylocale;
|
||||
bool result;
|
||||
Size len1,
|
||||
len2;
|
||||
|
||||
check_collation_set(collid);
|
||||
|
||||
if (!lc_collate_is_c(collid))
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (!pg_locale_deterministic(mylocale))
|
||||
ereport(ERROR,
|
||||
|
||||
Reference in New Issue
Block a user