We are converting a large database system from SQL Server 2022 to Postgres 18. The SQL Server collation is Latin1_General_CI_AS. The Postgres database default collation is English_United Kingdom.1252. The text columns in user tables have collation case_insensitive. We have changed this to replace CIText due to Postgres 18 now supporting LIKE comparisons over text using a nondeterministic collation. We want to keep case insensitivity from SQL Server.
We have found a few issues with this where we are forced to set Collation "C" (deterministic) in the query. 2 examples are recursive queries and using regular expression to replace likes not supported in Postges, i.e. [0-9] and [a-z]. We also use temp tables a lot and are unsure what the issues may be around collation problems for temp table text columns. When I try and check the collation of a temp table text column I get null.
create temporary table tmp_test(test text);
--Get the schema
SELECT pg_my_temp_schema()::regnamespace;
--returns pg_temp_288
select collation_name
from information_schema.columns
where table_schema =
( select distinct 'pg_temp_288'
from pg_stat_activity
)
and table_name = 'tmp_test';
--returns null
So it is hard to understand what problems we might be creating choosing case_insensitive collation over CITEXT for case insensitive searching.