tkt2817.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # 2007 December 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. # This file implements regression tests for SQLite library.
  12. #
  13. # Specifically, it tests that bug 2817 is fixed.
  14. #
  15. # $Id: tkt2817.test,v 1.2 2008/07/12 14:52:21 drh Exp $
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. do_test tkt2817-1.0 {
  19. execsql {
  20. CREATE TEMP TABLE tbl(a, b, c);
  21. -- INSERT INTO tbl VALUES(1, 'abc', 'def');
  22. -- INSERT INTO tbl VALUES(2, 'ghi', 'jkl');
  23. }
  24. } {}
  25. do_test tkt2817-1.1 {
  26. execsql {
  27. CREATE TABLE main.tbl(a, b, c);
  28. CREATE INDEX main.tbli ON tbl(a, b, c);
  29. INSERT INTO main.tbl SELECT a, b, c FROM temp.tbl;
  30. }
  31. } {}
  32. # When bug #2817 existed, this test was failing.
  33. #
  34. integrity_check tkt2817-1.2
  35. # So was this one.
  36. #
  37. db close
  38. sqlite3 db test.db
  39. integrity_check tkt2817-1.3
  40. # These tests - tkt2817-2.* - are the same as the previous block, except
  41. # for the fact that the temp-table and the main table do not share the
  42. # same name. #2817 did not cause a problem with these tests.
  43. #
  44. db close
  45. forcedelete test.db
  46. sqlite3 db test.db
  47. do_test tkt2817-2.0 {
  48. execsql {
  49. CREATE TEMP TABLE tmp(a, b, c);
  50. INSERT INTO tmp VALUES(1, 'abc', 'def');
  51. INSERT INTO tmp VALUES(2, 'ghi', 'jkl');
  52. }
  53. } {}
  54. do_test tkt2817-2.1 {
  55. execsql {
  56. CREATE TABLE main.tbl(a, b, c);
  57. CREATE INDEX main.tbli ON tbl(a, b, c);
  58. INSERT INTO main.tbl SELECT a, b, c FROM temp.tmp;
  59. }
  60. } {}
  61. integrity_check tkt2817-2.2
  62. db close
  63. sqlite3 db test.db
  64. integrity_check tkt2817-2.3
  65. finish_test