tkt-385a5b56b9.test 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # 2012 April 02
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. # The tests in this file were used while developing the SQLite 4 code.
  12. #
  13. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. set testprefix tkt-385a5b56b9
  16. do_execsql_test 1.0 {
  17. CREATE TABLE t1(x, y);
  18. INSERT INTO t1 VALUES(1, NULL);
  19. INSERT INTO t1 VALUES(2, NULL);
  20. INSERT INTO t1 VALUES(1, NULL);
  21. }
  22. do_execsql_test 1.1 { SELECT DISTINCT x, y FROM t1 } {1 {} 2 {}}
  23. do_execsql_test 1.2 { CREATE UNIQUE INDEX i1 ON t1(x, y) }
  24. do_execsql_test 1.3 { SELECT DISTINCT x, y FROM t1 } {1 {} 2 {}}
  25. #-------------------------------------------------------------------------
  26. do_execsql_test 2.0 {
  27. CREATE TABLE t2(x, y NOT NULL);
  28. CREATE UNIQUE INDEX t2x ON t2(x);
  29. CREATE UNIQUE INDEX t2y ON t2(y);
  30. }
  31. do_eqp_test 2.1 { SELECT DISTINCT x FROM t2 } {
  32. 0 0 0 {SCAN TABLE t2 USING COVERING INDEX t2x}
  33. }
  34. do_eqp_test 2.2 { SELECT DISTINCT y FROM t2 } {
  35. 0 0 0 {SCAN TABLE t2 USING COVERING INDEX t2y}
  36. }
  37. do_eqp_test 2.3 { SELECT DISTINCT x, y FROM t2 WHERE y=10 } {
  38. 0 0 0 {SEARCH TABLE t2 USING INDEX t2y (y=?)}
  39. }
  40. do_eqp_test 2.4 { SELECT DISTINCT x, y FROM t2 WHERE x=10 } {
  41. 0 0 0 {SEARCH TABLE t2 USING INDEX t2x (x=?)}
  42. }
  43. finish_test