tkt-6bfb98dfc0.test 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # 2013 March 27
  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. Specifically,
  12. # it tests that ticket [6bfb98dfc0]
  13. #
  14. # The final INSERT in the script below reports that the database is
  15. # corrupt (SQLITE_CORRUPT) and aborts even though the database is not
  16. # corrupt.
  17. #
  18. # PRAGMA page_size=512;
  19. # CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
  20. # INSERT INTO t1 VALUES(1,randomblob(400));
  21. # INSERT INTO t1 VALUES(2,randomblob(400));
  22. # INSERT INTO t1 SELECT x+2, randomblob(400) FROM t1;
  23. # INSERT INTO t1 SELECT x+4, randomblob(400) FROM t1;
  24. # INSERT INTO t1 SELECT x+8, randomblob(400) FROM t1;
  25. # INSERT INTO t1 SELECT x+16, randomblob(400) FROM t1;
  26. # INSERT INTO t1 SELECT x+32, randomblob(400) FROM t1;
  27. # INSERT INTO t1 SELECT x+64, randomblob(400) FROM t1 WHERE x<10;
  28. # CREATE TRIGGER r1 AFTER INSERT ON t1 WHEN new.x=74 BEGIN
  29. # DELETE FROM t1;
  30. # INSERT INTO t1 VALUES(75, randomblob(400));
  31. # INSERT INTO t1 VALUES(76, randomblob(400));
  32. # END;
  33. # INSERT INTO t1 VALUES(74, randomblob(400));
  34. #
  35. set testdir [file dirname $argv0]
  36. source $testdir/tester.tcl
  37. do_test tkt-6bfb98dfc0.100 {
  38. db eval {
  39. PRAGMA page_size=512;
  40. CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
  41. INSERT INTO t1 VALUES(1,randomblob(400));
  42. INSERT INTO t1 VALUES(2,randomblob(400));
  43. INSERT INTO t1 SELECT x+2, randomblob(400) FROM t1;
  44. INSERT INTO t1 SELECT x+4, randomblob(400) FROM t1;
  45. INSERT INTO t1 SELECT x+8, randomblob(400) FROM t1;
  46. INSERT INTO t1 SELECT x+16, randomblob(400) FROM t1;
  47. INSERT INTO t1 SELECT x+32, randomblob(400) FROM t1;
  48. INSERT INTO t1 SELECT x+64, randomblob(400) FROM t1 WHERE x<10;
  49. CREATE TRIGGER r1 AFTER INSERT ON t1 WHEN new.x=74 BEGIN
  50. DELETE FROM t1;
  51. INSERT INTO t1 VALUES(75, randomblob(400));
  52. INSERT INTO t1 VALUES(76, randomblob(400));
  53. END;
  54. INSERT INTO t1 VALUES(74, randomblob(400));
  55. SELECT x, length(y) FROM t1 ORDER BY x;
  56. }
  57. } {75 400 76 400}
  58. finish_test