Call pg_newlocale_from_collation() also with default collation
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 20 Jan 2022 08:38:05 +0000 (09:38 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 20 Jan 2022 08:50:18 +0000 (09:50 +0100)
commitb99ccd2cb2178b62b613edaf427fda8deace5bbf
treeec3beac28658ae0fd3cfd5078c4b6a9a1b9ebb17
parentb2a76bb7d0550fbfdc028e5bda4853d05444398a
Call pg_newlocale_from_collation() also with default collation

Previously, callers of pg_newlocale_from_collation() did not call it
if the collation was DEFAULT_COLLATION_OID and instead proceeded with
a pg_locale_t of 0.  Instead, now we call it anyway and have it return
0 if the default collation was passed.  It already did this, so we
just have to adjust the callers.  This simplifies all the call sites
and also makes future enhancements easier.

After discussion and testing, the previous comment in pg_locale.c
about avoiding this for performance reasons may have been mistaken
since it was testing a very different patch version way back when.

Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://www.postgresql.org/message-id/ed3baa81-7fac-7788-cc12-41e3f7917e34@enterprisedb.com
src/backend/access/hash/hashfunc.c
src/backend/regex/regc_pg_locale.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/like.c
src/backend/utils/adt/like_support.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c