tkt-d82e3f3721.test 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # 2009 September 2
  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. # This file implements tests to verify that ticket [d82e3f3721] has been
  14. # fixed.
  15. #
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. ifcapable !compound {
  19. finish_test
  20. return
  21. }
  22. do_test tkt-d82e3-1.1 {
  23. db eval {
  24. CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
  25. INSERT INTO t1 VALUES(null,'abc');
  26. INSERT INTO t1 VALUES(null,'def');
  27. DELETE FROM t1;
  28. INSERT INTO t1 VALUES(null,'ghi');
  29. SELECT * FROM t1;
  30. }
  31. } {3 ghi}
  32. do_test tkt-d82e3-1.2 {
  33. db eval {
  34. CREATE TEMP TABLE t2(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
  35. INSERT INTO t2 VALUES(null,'jkl');
  36. INSERT INTO t2 VALUES(null,'mno');
  37. DELETE FROM t2;
  38. INSERT INTO t2 VALUES(null,'pqr');
  39. SELECT * FROM t2;
  40. }
  41. } {3 pqr}
  42. do_test tkt-d82e3-1.3 {
  43. db eval {
  44. SELECT 'main', * FROM main.sqlite_sequence
  45. UNION ALL
  46. SELECT 'temp', * FROM temp.sqlite_sequence
  47. ORDER BY 2
  48. }
  49. } {main t1 3 temp t2 3}
  50. do_test tkt-d82e3-1.4 {
  51. db eval {
  52. VACUUM;
  53. SELECT 'main', * FROM main.sqlite_sequence
  54. UNION ALL
  55. SELECT 'temp', * FROM temp.sqlite_sequence
  56. ORDER BY 2
  57. }
  58. } {main t1 3 temp t2 3}
  59. sqlite3 db2 test.db
  60. do_test tkt-d82e3-2.1 {
  61. db eval {
  62. CREATE TEMP TABLE t3(x);
  63. INSERT INTO t3 VALUES(1);
  64. }
  65. db2 eval {
  66. CREATE TABLE t3(y,z);
  67. INSERT INTO t3 VALUES(8,9);
  68. }
  69. db eval {
  70. SELECT * FROM temp.t3 JOIN main.t3;
  71. }
  72. } {1 8 9}
  73. do_test tkt-d82e3-2.2 {
  74. db eval {
  75. VACUUM;
  76. SELECT * FROM temp.t3 JOIN main.t3;
  77. }
  78. } {1 8 9}
  79. db2 close
  80. finish_test