tkt-78e04e52ea.test 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # 2009 December 8
  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. # This file implements regression tests for SQLite library.
  12. #
  13. # Verify that we can create zero-length tables.
  14. #
  15. set testdir [file dirname $argv0]
  16. source $testdir/tester.tcl
  17. do_test tkt-78e04-1.0 {
  18. execsql {
  19. CREATE TABLE ""("" UNIQUE, x CHAR(100));
  20. CREATE TABLE t2(x);
  21. INSERT INTO ""("") VALUES(1);
  22. INSERT INTO t2 VALUES(2);
  23. SELECT * FROM "", t2;
  24. }
  25. } {1 {} 2}
  26. do_test tkt-78e04-1.1 {
  27. catchsql {
  28. INSERT INTO ""("") VALUES(1);
  29. }
  30. } {1 {column is not unique}}
  31. do_test tkt-78e04-1.2 {
  32. execsql {
  33. PRAGMA table_info("");
  34. }
  35. } {0 {} {} 0 {} 0 1 x CHAR(100) 0 {} 0}
  36. do_test tkt-78e04-1.3 {
  37. execsql {
  38. CREATE INDEX i1 ON ""("" COLLATE nocase);
  39. }
  40. } {}
  41. do_test tkt-78e04-1.4 {
  42. execsql {
  43. EXPLAIN QUERY PLAN SELECT "" FROM "" WHERE "" LIKE 'abc%';
  44. }
  45. } {0 0 0 {SCAN TABLE USING COVERING INDEX i1}}
  46. do_test tkt-78e04-1.5 {
  47. execsql {
  48. DROP TABLE "";
  49. SELECT name FROM sqlite_master;
  50. }
  51. } {t2}
  52. do_test tkt-78e04-2.1 {
  53. execsql {
  54. CREATE INDEX "" ON t2(x);
  55. EXPLAIN QUERY PLAN SELECT * FROM t2 WHERE x=5;
  56. }
  57. } {0 0 0 {SEARCH TABLE t2 USING COVERING INDEX (x=?)}}
  58. do_test tkt-78e04-2.2 {
  59. execsql {
  60. DROP INDEX "";
  61. EXPLAIN QUERY PLAN SELECT * FROM t2 WHERE x=2;
  62. }
  63. } {0 0 0 {SCAN TABLE t2}}
  64. finish_test