tkt3773.test 996 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # 2009 April 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. #
  12. # Ticket #3773: Be careful not to over-optimize when a compound
  13. # subquery contains an ORDER BY clause.
  14. #
  15. #
  16. # $Id: tkt3773.test,v 1.1 2009/04/02 16:59:47 drh Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. ifcapable !compound {
  20. finish_test
  21. return
  22. }
  23. do_test tkt3773-1.1 {
  24. db eval {
  25. CREATE TABLE t1(a,b);
  26. INSERT INTO t1 VALUES(2,1);
  27. INSERT INTO t1 VALUES(33,3);
  28. CREATE TABLE t2(x,y);
  29. INSERT INTO t2 VALUES(123,2);
  30. INSERT INTO t2 VALUES(4,4);
  31. SELECT a FROM (
  32. SELECT a, b FROM t1
  33. UNION ALL
  34. SELECT x, y FROM t2
  35. ORDER BY 2
  36. );
  37. }
  38. } {2 123 33 4}
  39. finish_test