mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 19:44:21 +01:00
SQLite generates those in aggregations like min / max with collation information either in the table definition or in the column expression. We currently generate the wrong result here, and properly generating the bytecode instruction fixes it.
77 lines
2.2 KiB
Tcl
Executable File
77 lines
2.2 KiB
Tcl
Executable File
#!/usr/bin/env tclsh
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# SIMPLE SMOKE TESTS THAT DO NOT DEPEND ON SPECIFIC DATABASE ROWS
|
|
|
|
do_execsql_test collate_nocase {
|
|
SELECT 'hat' == 'hAt' COLLATE NOCASE;
|
|
} {1}
|
|
|
|
do_execsql_test collate_binary_1 {
|
|
SELECT 'hat' == 'hAt' COLLATE BINARY;
|
|
} {0}
|
|
|
|
do_execsql_test collate_binary_2 {
|
|
SELECT 'hat' == 'hat' COLLATE BINARY;
|
|
} {1}
|
|
|
|
do_execsql_test collate_rtrim_1 {
|
|
SELECT 'hat' == 'hAt ' COLLATE RTRIM;
|
|
} {0}
|
|
|
|
do_execsql_test collate_rtrim_2 {
|
|
SELECT 'hat' == 'hat ' COLLATE RTRIM;
|
|
} {1}
|
|
|
|
do_execsql_test collate_rtrim_3 {
|
|
SELECT 'hat' == ' hAt ' COLLATE RTRIM;
|
|
} {0}
|
|
|
|
do_execsql_test collate_rtrim_4 {
|
|
SELECT 'hat' == ' hat ' COLLATE RTRIM;
|
|
} {0}
|
|
|
|
do_execsql_test collate_left_precedence {
|
|
SELECT 'hat' COLLATE BINARY == 'hAt' COLLATE NOCASE;
|
|
} {0}
|
|
|
|
do_execsql_test collate_left_precedence_2 {
|
|
SELECT 'hat' COLLATE NOCASE == 'hAt' COLLATE BINARY;
|
|
} {1}
|
|
|
|
do_execsql_test_in_memory_any_error collate_unique_constraint {
|
|
CREATE TABLE t (a TEXT COLLATE NOCASE PRIMARY KEY);
|
|
INSERT INTO t VALUES ('lol'), ('LOL'), ('lOl');
|
|
}
|
|
|
|
do_execsql_test_in_memory_any_error collate_unique_constraint {
|
|
CREATE TABLE t (a TEXT COLLATE NOCASE PRIMARY KEY);
|
|
INSERT INTO t VALUES ('lol'), ('LOL'), ('lOl');
|
|
}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_default_binary {
|
|
create table fruits(name collate binary);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name) from fruits;
|
|
} {banana}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_default_nocase {
|
|
create table fruits(name collate nocase);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name) from fruits;
|
|
} {CHERRY}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_explicit_binary {
|
|
create table fruits(name collate nocase);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name collate binary) from fruits;
|
|
} {banana}
|
|
|
|
do_execsql_test_on_specific_db {:memory:} collate_aggregation_explicit_nocase {
|
|
create table fruits(name collate binary);
|
|
insert into fruits(name) values ('Apple') ,('banana') ,('CHERRY');
|
|
select max(name collate nocase) from fruits;
|
|
} {CHERRY}
|