4 # The author disclaims copyright to this source code. In place of
5 # a legal notice, here is a blessing:
7 # May you do good and not evil.
8 # May you find forgiveness for yourself and forgive others.
9 # May you share freely, never taking more than you give.
11 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this script is page cache subsystem.
15 # $Id: collate2.test,v 1.6 2008/08/20 16:35:10 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 set ::testprefix collate2
23 # Tests are organised as follows:
25 # collate2-1.* WHERE <expr> expressions (sqliteExprIfTrue).
26 # collate2-2.* WHERE NOT <expr> expressions (sqliteExprIfFalse).
27 # collate2-3.* SELECT <expr> expressions (sqliteExprCode).
28 # collate2-4.* Precedence of collation/data types in binary comparisons
29 # collate2-5.* JOIN syntax.
32 # Create a collation type BACKWARDS for use in testing. This collation type
33 # is similar to the built-in TEXT collation type except the order of
34 # characters in each string is reversed before the comparison is performed.
35 db collate BACKWARDS backwards_collate
36 proc backwards_collate {a b} {
39 foreach c [split $a {}] { set ra $c$ra }
40 foreach c [split $b {}] { set rb $c$rb }
41 return [string compare $ra $rb]
44 # The following values are used in these tests:
45 # NULL aa ab ba bb aA aB bA bB Aa Ab Ba Bb AA AB BA BB
47 # The collation orders for each of the tested collation types are:
49 # BINARY: NULL AA AB Aa Ab BA BB Ba Bb aA aB aa ab bA bB ba bb
50 # NOCASE: NULL aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB
51 # BACKWARDS: NULL AA BA aA bA AB BB aB bB Aa Ba aa ba Ab Bb ab bb
53 # These tests verify that the default collation type for a column is used
54 # for comparison operators (<, >, <=, >=, =) involving that column and
55 # an expression that is not a column with a default collation type.
57 # The collation sequences BINARY and NOCASE are built-in, the BACKWARDS
58 # collation sequence is implemented by the TCL proc backwards_collate
61 do_test collate2-1.0 {
63 CREATE TABLE collate2t1(
68 INSERT INTO collate2t1 VALUES( NULL, NULL, NULL );
70 INSERT INTO collate2t1 VALUES( 'aa', 'aa', 'aa' );
71 INSERT INTO collate2t1 VALUES( 'ab', 'ab', 'ab' );
72 INSERT INTO collate2t1 VALUES( 'ba', 'ba', 'ba' );
73 INSERT INTO collate2t1 VALUES( 'bb', 'bb', 'bb' );
75 INSERT INTO collate2t1 VALUES( 'aA', 'aA', 'aA' );
76 INSERT INTO collate2t1 VALUES( 'aB', 'aB', 'aB' );
77 INSERT INTO collate2t1 VALUES( 'bA', 'bA', 'bA' );
78 INSERT INTO collate2t1 VALUES( 'bB', 'bB', 'bB' );
80 INSERT INTO collate2t1 VALUES( 'Aa', 'Aa', 'Aa' );
81 INSERT INTO collate2t1 VALUES( 'Ab', 'Ab', 'Ab' );
82 INSERT INTO collate2t1 VALUES( 'Ba', 'Ba', 'Ba' );
83 INSERT INTO collate2t1 VALUES( 'Bb', 'Bb', 'Bb' );
85 INSERT INTO collate2t1 VALUES( 'AA', 'AA', 'AA' );
86 INSERT INTO collate2t1 VALUES( 'AB', 'AB', 'AB' );
87 INSERT INTO collate2t1 VALUES( 'BA', 'BA', 'BA' );
88 INSERT INTO collate2t1 VALUES( 'BB', 'BB', 'BB' );
90 if {[info exists collate_test_use_index]} {
92 CREATE INDEX collate2t1_i1 ON collate2t1(a);
93 CREATE INDEX collate2t1_i2 ON collate2t1(b);
94 CREATE INDEX collate2t1_i3 ON collate2t1(c);
98 do_test collate2-1.1 {
100 SELECT a FROM collate2t1 WHERE a > 'aa' ORDER BY 1;
103 do_test collate2-1.1.1 {
105 SELECT a FROM collate2t1 WHERE a COLLATE binary > 'aa' ORDER BY 1;
108 do_test collate2-1.1.2 {
110 SELECT a FROM collate2t1 WHERE b COLLATE binary > 'aa' ORDER BY 1;
113 do_test collate2-1.1.3 {
115 SELECT a FROM collate2t1 WHERE c COLLATE binary > 'aa' ORDER BY 1;
118 do_test collate2-1.2 {
120 SELECT b FROM collate2t1 WHERE b > 'aa' ORDER BY 1, oid;
122 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
123 do_test collate2-1.2.1 {
125 SELECT b FROM collate2t1 WHERE a COLLATE nocase > 'aa'
128 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
129 do_test collate2-1.2.2 {
131 SELECT b FROM collate2t1 WHERE b COLLATE nocase > 'aa'
134 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
135 do_test collate2-1.2.3 {
137 SELECT b FROM collate2t1 WHERE c COLLATE nocase > 'aa'
140 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
141 do_test collate2-1.2.4 {
143 SELECT b FROM collate2t1 WHERE b > 'aa' ORDER BY +b;
145 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
146 do_test collate2-1.2.5 {
148 SELECT b FROM collate2t1 WHERE a COLLATE nocase > 'aa' ORDER BY +b;
150 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
151 do_test collate2-1.2.6 {
153 SELECT b FROM collate2t1 WHERE b COLLATE nocase > 'aa' ORDER BY +b;
155 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
156 do_test collate2-1.2.7 {
158 SELECT b FROM collate2t1 WHERE c COLLATE nocase > 'aa' ORDER BY +b;
160 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
161 do_test collate2-1.3 {
163 SELECT c FROM collate2t1 WHERE c > 'aa' ORDER BY 1;
166 do_test collate2-1.3.1 {
168 SELECT c FROM collate2t1 WHERE a COLLATE backwards > 'aa'
172 do_test collate2-1.3.2 {
174 SELECT c FROM collate2t1 WHERE b COLLATE backwards > 'aa'
178 do_test collate2-1.3.3 {
180 SELECT c FROM collate2t1 WHERE c COLLATE backwards > 'aa'
184 do_test collate2-1.4 {
186 SELECT a FROM collate2t1 WHERE a < 'aa' ORDER BY 1;
188 } {AA AB Aa Ab BA BB Ba Bb aA aB}
189 do_test collate2-1.5 {
191 SELECT b FROM collate2t1 WHERE b < 'aa' ORDER BY 1, oid;
194 do_test collate2-1.5.1 {
196 SELECT b FROM collate2t1 WHERE b < 'aa' ORDER BY +b;
199 do_test collate2-1.6 {
201 SELECT c FROM collate2t1 WHERE c < 'aa' ORDER BY 1;
203 } {AA BA aA bA AB BB aB bB Aa Ba}
204 do_test collate2-1.7 {
206 SELECT a FROM collate2t1 WHERE a = 'aa';
209 do_test collate2-1.8 {
211 SELECT b FROM collate2t1 WHERE b = 'aa' ORDER BY oid;
214 do_test collate2-1.9 {
216 SELECT c FROM collate2t1 WHERE c = 'aa';
219 do_test collate2-1.10 {
221 SELECT a FROM collate2t1 WHERE a >= 'aa' ORDER BY 1;
223 } {aa ab bA bB ba bb}
224 do_test collate2-1.11 {
226 SELECT b FROM collate2t1 WHERE b >= 'aa' ORDER BY 1, oid;
228 } {aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB}
229 do_test collate2-1.12 {
231 SELECT c FROM collate2t1 WHERE c >= 'aa' ORDER BY 1;
233 } {aa ba Ab Bb ab bb}
234 do_test collate2-1.13 {
236 SELECT a FROM collate2t1 WHERE a <= 'aa' ORDER BY 1;
238 } {AA AB Aa Ab BA BB Ba Bb aA aB aa}
239 do_test collate2-1.14 {
241 SELECT b FROM collate2t1 WHERE b <= 'aa' ORDER BY 1, oid;
244 do_test collate2-1.15 {
246 SELECT c FROM collate2t1 WHERE c <= 'aa' ORDER BY 1;
248 } {AA BA aA bA AB BB aB bB Aa Ba aa}
249 do_test collate2-1.16 {
251 SELECT a FROM collate2t1 WHERE a BETWEEN 'Aa' AND 'Bb' ORDER BY 1;
253 } {Aa Ab BA BB Ba Bb}
254 do_test collate2-1.17 {
256 SELECT b FROM collate2t1 WHERE b BETWEEN 'Aa' AND 'Bb' ORDER BY 1, oid;
258 } {aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB}
259 do_test collate2-1.17.1 {
261 SELECT b FROM collate2t1 WHERE b BETWEEN 'Aa' AND 'Bb' ORDER BY +b;
263 } {aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB}
264 do_test collate2-1.18 {
266 SELECT c FROM collate2t1 WHERE c BETWEEN 'Aa' AND 'Bb' ORDER BY 1;
268 } {Aa Ba aa ba Ab Bb}
269 do_test collate2-1.19 {
271 SELECT a FROM collate2t1 WHERE
272 CASE a WHEN 'aa' THEN 1 ELSE 0 END
276 do_test collate2-1.20 {
278 SELECT b FROM collate2t1 WHERE
279 CASE b WHEN 'aa' THEN 1 ELSE 0 END
283 do_test collate2-1.21 {
285 SELECT c FROM collate2t1 WHERE
286 CASE c WHEN 'aa' THEN 1 ELSE 0 END
292 do_test collate2-1.22 {
294 SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb') ORDER BY 1, oid;
297 do_test collate2-1.23 {
299 SELECT b FROM collate2t1 WHERE b IN ('aa', 'bb') ORDER BY 1, oid;
301 } {aa aA Aa AA bb bB Bb BB}
302 do_test collate2-1.24 {
304 SELECT c FROM collate2t1 WHERE c IN ('aa', 'bb') ORDER BY 1, oid;
307 do_test collate2-1.25 {
309 SELECT a FROM collate2t1
310 WHERE a IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'));
313 do_test collate2-1.26 {
315 SELECT b FROM collate2t1
316 WHERE b IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'));
318 } {aa bb aA bB Aa Bb AA BB}
319 do_test collate2-1.27 {
321 SELECT c FROM collate2t1
322 WHERE c IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'));
325 } ;# ifcapable subquery
327 do_test collate2-2.1 {
329 SELECT a FROM collate2t1 WHERE NOT a > 'aa' ORDER BY 1;
331 } {AA AB Aa Ab BA BB Ba Bb aA aB aa}
332 do_test collate2-2.2 {
334 SELECT b FROM collate2t1 WHERE NOT b > 'aa' ORDER BY 1, oid;
337 do_test collate2-2.3 {
339 SELECT c FROM collate2t1 WHERE NOT c > 'aa' ORDER BY 1;
341 } {AA BA aA bA AB BB aB bB Aa Ba aa}
342 do_test collate2-2.4 {
344 SELECT a FROM collate2t1 WHERE NOT a < 'aa' ORDER BY 1;
346 } {aa ab bA bB ba bb}
347 do_test collate2-2.5 {
349 SELECT b FROM collate2t1 WHERE NOT b < 'aa' ORDER BY 1, oid;
351 } {aa aA Aa AA ab aB Ab AB ba bA Ba BA bb bB Bb BB}
352 do_test collate2-2.6 {
354 SELECT c FROM collate2t1 WHERE NOT c < 'aa' ORDER BY 1;
356 } {aa ba Ab Bb ab bb}
357 do_test collate2-2.7 {
359 SELECT a FROM collate2t1 WHERE NOT a = 'aa';
361 } {ab ba bb aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
362 do_test collate2-2.8 {
364 SELECT b FROM collate2t1 WHERE NOT b = 'aa';
366 } {ab ba bb aB bA bB Ab Ba Bb AB BA BB}
367 do_test collate2-2.9 {
369 SELECT c FROM collate2t1 WHERE NOT c = 'aa';
371 } {ab ba bb aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
372 do_test collate2-2.10 {
374 SELECT a FROM collate2t1 WHERE NOT a >= 'aa' ORDER BY 1;
376 } {AA AB Aa Ab BA BB Ba Bb aA aB}
377 do_test collate2-2.11 {
379 SELECT b FROM collate2t1 WHERE NOT b >= 'aa' ORDER BY 1, oid;
382 do_test collate2-2.12 {
384 SELECT c FROM collate2t1 WHERE NOT c >= 'aa' ORDER BY 1;
386 } {AA BA aA bA AB BB aB bB Aa Ba}
387 do_test collate2-2.13 {
389 SELECT a FROM collate2t1 WHERE NOT a <= 'aa' ORDER BY 1;
392 do_test collate2-2.14 {
394 SELECT b FROM collate2t1 WHERE NOT b <= 'aa' ORDER BY 1, oid;
396 } {ab aB Ab AB ba bA Ba BA bb bB Bb BB}
397 do_test collate2-2.15 {
399 SELECT c FROM collate2t1 WHERE NOT c <= 'aa' ORDER BY 1;
402 do_test collate2-2.16 {
404 SELECT a FROM collate2t1 WHERE a NOT BETWEEN 'Aa' AND 'Bb' ORDER BY 1;
406 } {AA AB aA aB aa ab bA bB ba bb}
407 do_test collate2-2.17 {
409 SELECT b FROM collate2t1 WHERE b NOT BETWEEN 'Aa' AND 'Bb' ORDER BY 1, oid;
412 do_test collate2-2.18 {
414 SELECT c FROM collate2t1 WHERE c NOT BETWEEN 'Aa' AND 'Bb' ORDER BY 1;
416 } {AA BA aA bA AB BB aB bB ab bb}
417 do_test collate2-2.19 {
419 SELECT a FROM collate2t1 WHERE NOT CASE a WHEN 'aa' THEN 1 ELSE 0 END;
421 } {{} ab ba bb aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
422 do_test collate2-2.20 {
424 SELECT b FROM collate2t1 WHERE NOT CASE b WHEN 'aa' THEN 1 ELSE 0 END;
426 } {{} ab ba bb aB bA bB Ab Ba Bb AB BA BB}
427 do_test collate2-2.21 {
429 SELECT c FROM collate2t1 WHERE NOT CASE c WHEN 'aa' THEN 1 ELSE 0 END;
431 } {{} ab ba bb aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
434 do_test collate2-2.22 {
436 SELECT a FROM collate2t1 WHERE NOT a IN ('aa', 'bb');
438 } {ab ba aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
439 do_test collate2-2.23 {
441 SELECT b FROM collate2t1 WHERE NOT b IN ('aa', 'bb');
443 } {ab ba aB bA Ab Ba AB BA}
444 do_test collate2-2.24 {
446 SELECT c FROM collate2t1 WHERE NOT c IN ('aa', 'bb');
448 } {ab ba aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
449 do_test collate2-2.25 {
451 SELECT a FROM collate2t1
452 WHERE NOT a IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'));
454 } {ab ba aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
455 do_test collate2-2.26 {
457 SELECT b FROM collate2t1
458 WHERE NOT b IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'));
460 } {ab ba aB bA Ab Ba AB BA}
461 do_test collate2-2.27 {
463 SELECT c FROM collate2t1
464 WHERE NOT c IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'));
466 } {ab ba aA aB bA bB Aa Ab Ba Bb AA AB BA BB}
469 do_test collate2-3.1 {
471 SELECT a > 'aa' FROM collate2t1;
473 } {{} 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0}
474 do_test collate2-3.2 {
476 SELECT b > 'aa' FROM collate2t1;
478 } {{} 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1}
479 do_test collate2-3.3 {
481 SELECT c > 'aa' FROM collate2t1;
483 } {{} 0 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0}
484 do_test collate2-3.4 {
486 SELECT a < 'aa' FROM collate2t1;
488 } {{} 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1}
489 do_test collate2-3.5 {
491 SELECT b < 'aa' FROM collate2t1;
493 } {{} 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
494 do_test collate2-3.6 {
496 SELECT c < 'aa' FROM collate2t1;
498 } {{} 0 0 0 0 1 1 1 1 1 0 1 0 1 1 1 1}
499 do_test collate2-3.7 {
501 SELECT a = 'aa' FROM collate2t1;
503 } {{} 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
504 do_test collate2-3.8 {
506 SELECT b = 'aa' FROM collate2t1;
508 } {{} 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0}
509 do_test collate2-3.9 {
511 SELECT c = 'aa' FROM collate2t1;
513 } {{} 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
514 do_test collate2-3.10 {
516 SELECT a <= 'aa' FROM collate2t1;
518 } {{} 1 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1}
519 do_test collate2-3.11 {
521 SELECT b <= 'aa' FROM collate2t1;
523 } {{} 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0}
524 do_test collate2-3.12 {
526 SELECT c <= 'aa' FROM collate2t1;
528 } {{} 1 0 0 0 1 1 1 1 1 0 1 0 1 1 1 1}
529 do_test collate2-3.13 {
531 SELECT a >= 'aa' FROM collate2t1;
533 } {{} 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0}
534 do_test collate2-3.14 {
536 SELECT b >= 'aa' FROM collate2t1;
538 } {{} 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1}
539 do_test collate2-3.15 {
541 SELECT c >= 'aa' FROM collate2t1;
543 } {{} 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0}
544 do_test collate2-3.16 {
546 SELECT a BETWEEN 'Aa' AND 'Bb' FROM collate2t1;
548 } {{} 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1}
549 do_test collate2-3.17 {
551 SELECT b BETWEEN 'Aa' AND 'Bb' FROM collate2t1;
553 } {{} 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1}
554 do_test collate2-3.18 {
556 SELECT c BETWEEN 'Aa' AND 'Bb' FROM collate2t1;
558 } {{} 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0}
559 do_test collate2-3.19 {
561 SELECT CASE a WHEN 'aa' THEN 1 ELSE 0 END FROM collate2t1;
563 } {0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
564 do_test collate2-3.20 {
566 SELECT CASE b WHEN 'aa' THEN 1 ELSE 0 END FROM collate2t1;
568 } {0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0}
569 do_test collate2-3.21 {
571 SELECT CASE c WHEN 'aa' THEN 1 ELSE 0 END FROM collate2t1;
573 } {0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
576 do_test collate2-3.22 {
578 SELECT a IN ('aa', 'bb') FROM collate2t1;
580 } {{} 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0}
581 do_test collate2-3.23 {
583 SELECT b IN ('aa', 'bb') FROM collate2t1;
585 } {{} 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1}
586 do_test collate2-3.24 {
588 SELECT c IN ('aa', 'bb') FROM collate2t1;
590 } {{} 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0}
591 do_test collate2-3.25 {
593 SELECT a IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'))
596 } {{} 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0}
597 do_test collate2-3.26 {
599 SELECT b IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'))
602 } {{} 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1}
603 do_test collate2-3.27 {
605 SELECT c IN (SELECT a FROM collate2t1 WHERE a IN ('aa', 'bb'))
608 } {{} 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0}
611 do_test collate2-4.0 {
613 CREATE TABLE collate2t2(b COLLATE binary);
614 CREATE TABLE collate2t3(b text);
615 INSERT INTO collate2t2 VALUES('aa');
616 INSERT INTO collate2t3 VALUES('aa');
620 # Test that when both sides of a binary comparison operator have
621 # default collation types, the collate type for the leftmost term
623 do_test collate2-4.1 {
625 SELECT collate2t1.a FROM collate2t1, collate2t2
626 WHERE collate2t1.b = collate2t2.b;
629 do_test collate2-4.2 {
631 SELECT collate2t1.a FROM collate2t1, collate2t2
632 WHERE collate2t2.b = collate2t1.b;
636 # Test that when one side has a default collation type and the other
637 # does not, the collation type is used.
638 do_test collate2-4.3 {
640 SELECT collate2t1.a FROM collate2t1, collate2t3
641 WHERE collate2t1.b = collate2t3.b||''
642 ORDER BY +collate2t1.a DESC;
645 do_test collate2-4.4 {
647 SELECT collate2t1.a FROM collate2t1, collate2t3
648 WHERE collate2t3.b||'' = collate2t1.b
649 ORDER BY +collate2t1.a DESC;
653 do_test collate2-4.5 {
655 DROP TABLE collate2t3;
660 # Test that the default collation types are used when the JOIN syntax
661 # is used in place of a WHERE clause.
663 # SQLite transforms the JOIN syntax into a WHERE clause internally, so
664 # the focus of these tests is to ensure that the table on the left-hand-side
665 # of the join determines the collation type used.
667 do_test collate2-5.0 {
669 SELECT collate2t1.b FROM collate2t1 JOIN collate2t2 USING (b);
672 do_test collate2-5.1 {
674 SELECT collate2t1.b FROM collate2t2 JOIN collate2t1 USING (b);
677 do_test collate2-5.2 {
679 SELECT collate2t1.b FROM collate2t1 NATURAL JOIN collate2t2;
682 do_test collate2-5.3 {
684 SELECT collate2t1.b FROM collate2t2 NATURAL JOIN collate2t1;
687 do_test collate2-5.4.1 {
689 SELECT collate2t2.b FROM collate2t1 LEFT JOIN collate2t2 USING (b) order by collate2t1.oid;
691 } {{} aa {} {} {} aa {} {} {} aa {} {} {} aa {} {} {}}
692 do_test collate2-5.4.2 {
694 SELECT collate2t2.b FROM collate2t2 RIGHT JOIN collate2t1 ON collate2t1.b=collate2t2.b
695 ORDER BY collate2t1.oid;
697 } {{} aa {} {} {} aa {} {} {} aa {} {} {} aa {} {} {}}
698 do_test collate2-5.4.3 {
700 SELECT collate2t2.b FROM collate2t1 LEFT JOIN collate2t2 ON collate2t2.b=collate2t1.b
701 ORDER BY collate2t1.oid;
703 } {{} aa {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}}
704 do_test collate2-5.5.1 {
706 SELECT collate2t1.b, collate2t2.b FROM collate2t2 LEFT OUTER JOIN collate2t1 USING (b);
709 do_test collate2-5.5.2 {
711 SELECT collate2t1.b, collate2t2.b
712 FROM collate2t1 RIGHT JOIN collate2t2 ON collate2t2.b=collate2t1.b
716 do_execsql_test 6.1 {
718 INSERT INTO t1 VALUES('b');
719 INSERT INTO t1 VALUES('B');
721 do_execsql_test 6.2 {
722 SELECT * FROM t1 WHERE x COLLATE nocase BETWEEN 'a' AND 'c';
724 do_execsql_test 6.3 {
725 SELECT * FROM t1 WHERE x BETWEEN 'a' COLLATE nocase AND 'c' COLLATE nocase;
727 do_execsql_test 6.4 {
729 WHERE x COLLATE nocase BETWEEN 'a' COLLATE nocase AND 'c' COLLATE nocase;
731 do_execsql_test 6.5 {
732 SELECT * FROM t1 WHERE +x COLLATE nocase BETWEEN 'a' AND 'c';
734 do_execsql_test 6.6 {
735 SELECT * FROM t1 WHERE +x BETWEEN 'a' COLLATE nocase AND 'c' COLLATE nocase;
737 do_execsql_test 6.7 {
739 WHERE +x COLLATE nocase BETWEEN 'a' COLLATE nocase AND 'c' COLLATE nocase;