1
0

tkt-868145d012.test 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # 2013 March 05
  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 [868145d012a1] is fixed.
  13. #
  14. set testdir [file dirname $argv0]
  15. source $testdir/tester.tcl
  16. do_execsql_test tkt-868145d012.100 {
  17. CREATE TABLE p (
  18. id INTEGER PRIMARY KEY,
  19. uid VARCHAR(36),
  20. t INTEGER
  21. );
  22. CREATE TABLE pa (
  23. id INTEGER PRIMARY KEY,
  24. a_uid VARCHAR(36)
  25. );
  26. CREATE TABLE a (
  27. id INTEGER PRIMARY KEY,
  28. uid VARCHAR(36),
  29. t INTEGER
  30. );
  31. INSERT INTO pa VALUES(1,'1234');
  32. INSERT INTO pa VALUES(2,'2345');
  33. INSERT INTO p VALUES(3,'1234',97);
  34. INSERT INTO p VALUES(4,'1234',98);
  35. INSERT INTO a VALUES(5,'1234',98);
  36. INSERT INTO a VALUES(6,'1234',99);
  37. } {}
  38. do_execsql_test tkt-868145d012.110 {
  39. SELECT DISTINCT pa.id, p.id, a.id
  40. FROM
  41. pa
  42. LEFT JOIN p ON p.uid='1234'
  43. LEFT JOIN a ON a.uid=pa.a_uid
  44. WHERE
  45. a.t=p.t
  46. ;
  47. } {1 4 5}
  48. do_execsql_test tkt-868145d012.120 {
  49. SELECT DISTINCT pa.id, p.id, a.id
  50. FROM
  51. pa
  52. LEFT JOIN p ON p.uid='1234'
  53. LEFT JOIN a ON a.uid=pa.a_uid AND a.t=p.t
  54. ORDER BY 1, 2, 3
  55. ;
  56. } {1 3 {} 1 4 5 2 3 {} 2 4 {}}
  57. finish_test