modernc.org/cc@v1.0.1/v2/testdata/_sqlite/ext/fts5/test/fts5leftjoin.test (about)

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