Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add list of collations that are required to determine equality. #9757

Merged
merged 5 commits into from Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion extension/icu/icu_extension.cpp
Expand Up @@ -238,7 +238,7 @@ void IcuExtension::Load(DuckDB &ddb) {
}
collation = StringUtil::Lower(collation);

CreateCollationInfo info(collation, GetICUFunction(collation), false, true);
CreateCollationInfo info(collation, GetICUFunction(collation), false, false);
ExtensionUtil::RegisterCollation(db, info);
}
ScalarFunction sort_key("icu_sort_key", {LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR,
Expand Down
38 changes: 38 additions & 0 deletions test/sql/collate/test_icu_collate.test
Expand Up @@ -82,3 +82,41 @@ statement error
SELECT icu_sort_key('goose', 'DUCK_DUCK_ENUM');
----
Invalid Input Error


# issue duckdb/duckdb#9692
query I
select chr(2*16*256+1*256+2*16+11) collate da =chr(12*16+5) collate da;
----
True


query I
select icu_sort_key(chr(2*16*256+1*256+2*16+11),'da')=icu_sort_key(chr(12*16+5),'da');
----
True

query I
select chr(2*16*256+1*256+2*16+11) collate da > chr(12*16+5) collate da;
----
FALSE

query I
select chr(2*16*256+1*256+2*16+11) collate da > chr(12*16+5) collate da;
----
FALSE

query I
select count(*) from (select chr(2*16*256+1*256+2*16+11) union select chr(12*16+5)) as t(s) group by s collate da;
----
2

query I
select nfc_normalize(chr(2*16*256+1*256+2*16+11))=nfc_normalize(chr(12*16+5));
----
TRUE

query I
select count(*) from (select chr(2*16*256+1*256+2*16+11) union select chr(12*16+5)) as t(s) group by s collate nfc;
----
2