hi.
I further simplified your test case.
create or replace function to_upper_first(param1 text, param2 text)
returns text as $$
select upper(param1) || '_'
$$ language sql;
select to_upper_first('тест', 'a'::text);
select to_upper_first('тест', 'a'::text collate "default");
select to_upper_first('тест', 'a'::text collate "C");
select to_upper_first('тест', current_user);
select to_upper_first('тест', user::text);
select to_upper_first('тест', current_database()::text);
select to_upper_first('тест', current_schema()::text);
select to_upper_first('тест', current_schemas(true)::text);
These current.* functions always use the "C" collation for their
output, so in this case, they are not related to session variables, in
my view.
essentially, i think, your question is about the difference of
select to_upper_first('тест', 'a'::text);
and
select to_upper_first('тест', 'a'::text collate "C");
you may also see.
https://git.postgresql.org/cgit/postgresql.git/tree/src/test/regress/expected/collate.icu.utf8.out#n896
--
jian
https://www.enterprisedb.com/