fts5leftjoin.test 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # 2014 June 17
  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. The
  12. # focus of this script is testing the FTS5 module.
  13. #
  14. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5leftjoin
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.0 {
  22. CREATE VIRTUAL TABLE vt USING fts5(x);
  23. INSERT INTO vt VALUES('abc');
  24. INSERT INTO vt VALUES('xyz');
  25. CREATE TABLE t1(a INTEGER PRIMARY KEY);
  26. INSERT INTO t1 VALUES(1), (2);
  27. }
  28. do_execsql_test 1.1 {
  29. SELECT * FROM t1 LEFT JOIN (
  30. SELECT rowid AS rrr, * FROM vt WHERE vt MATCH 'abc'
  31. ) ON t1.a = rrr
  32. } {1 1 abc 2 {} {}}
  33. do_execsql_test 1.2 {
  34. SELECT * FROM t1 LEFT JOIN vt ON (vt MATCH 'abc')
  35. } {1 abc 2 abc}
  36. finish_test