tkt3911.test 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # 2009 June 11
  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. # Tests to verify ticket #3911 is fixed.
  13. #
  14. # $Id: tkt3911.test,v 1.1 2009/06/12 03:27:28 drh Exp $
  15. set testdir [file dirname $argv0]
  16. source $testdir/tester.tcl
  17. do_test tkt3911.1 {
  18. execsql {
  19. CREATE TABLE t1(a,b);
  20. INSERT INTO t1 VALUES(1,2);
  21. INSERT INTO t1 VALUES(11,12);
  22. CREATE TABLE t2(b,c);
  23. INSERT INTO t2 VALUES(2,3);
  24. INSERT INTO t2 VALUES(22,23);
  25. SELECT * FROM t1 JOIN t2 USING(b);
  26. }
  27. } {1 2 3}
  28. do_test tkt3911.2 {
  29. db eval {
  30. SELECT * FROM t1 JOIN (t2) AS x USING (b);
  31. }
  32. } {1 2 3}
  33. do_test tkt3911.3 {
  34. db eval {
  35. SELECT * FROM t1 JOIN (SELECT * FROM t2) AS x USING (b);
  36. }
  37. } {1 2 3}
  38. do_test tkt3911.4 {
  39. db eval {
  40. CREATE TABLE t3(m,a);
  41. INSERT INTO t3 VALUES('one',1);
  42. INSERT INTO t3 VALUES('two',2);
  43. SELECT * FROM t3 JOIN (SELECT * FROM t1 NATURAL JOIN t2) AS x USING(a);
  44. }
  45. } {one 1 2 3}
  46. do_test tkt3911.5 {
  47. db eval {
  48. SELECT * FROM t3 JOIN (SELECT * FROM t1 JOIN t2 USING (b)) AS x USING(a);
  49. }
  50. } {one 1 2 3}
  51. finish_test