tkt1444.test 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # 2005 September 19
  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 #1444 has been
  14. # fixed.
  15. #
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. ifcapable !compound||!view {
  19. finish_test
  20. return
  21. }
  22. # The use of a VIEW that contained an ORDER BY clause within a UNION ALL
  23. # was causing problems. See ticket #1444.
  24. #
  25. do_test tkt1444-1.1 {
  26. execsql {
  27. CREATE TABLE DemoTable (x INTEGER, TextKey TEXT, DKey Real);
  28. CREATE INDEX DemoTableIdx ON DemoTable (TextKey);
  29. INSERT INTO DemoTable VALUES(9,8,7);
  30. INSERT INTO DemoTable VALUES(1,2,3);
  31. CREATE VIEW DemoView AS SELECT * FROM DemoTable ORDER BY TextKey;
  32. SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
  33. }
  34. } {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
  35. do_test tkt1444-1.2 {
  36. execsql {
  37. SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
  38. }
  39. } {9 8 7.0 1 2 3.0 1 2 3.0 9 8 7.0}
  40. do_test tkt1444-1.3 {
  41. execsql {
  42. DROP VIEW DemoView;
  43. CREATE VIEW DemoView AS SELECT * FROM DemoTable;
  44. SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView ORDER BY 1;
  45. }
  46. } {1 2 3.0 1 2 3.0 9 8 7.0 9 8 7.0}
  47. do_test tkt1444-1.4 {
  48. execsql {
  49. SELECT * FROM DemoTable UNION ALL SELECT * FROM DemoView;
  50. }
  51. } {9 8 7.0 1 2 3.0 9 8 7.0 1 2 3.0}
  52. finish_test