1# 2009 July 1
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.
12#
13# This file implements tests to verify that ticket #3935 has been fixed.
14#
15# $Id: tkt3935.test,v 1.2 2009/07/01 16:12:08 danielk1977 Exp $
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
20do_test tkt3935.1 {
21  execsql {
22    CREATE TABLE t1(a, b);
23    CREATE TABLE t2(c, d);
24  }
25} {}
26
27do_test tkt3935.2 {
28  execsql { SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1 }
29} {}
30do_test tkt3935.3 {
31  execsql { SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1 }
32} {}
33
34
35do_test tkt3935.4 {
36  catchsql { SELECT a FROM (t1) AS t ON b USING(a) }
37} {1 {a JOIN clause is required before ON}}
38do_test tkt3935.5 {
39  catchsql { SELECT a FROM (t1) AS t ON b }
40} {1 {a JOIN clause is required before ON}}
41do_test tkt3935.6 {
42  catchsql { SELECT a FROM (SELECT * FROM t1) AS t ON b USING(a) }
43} {1 {a JOIN clause is required before ON}}
44do_test tkt3935.7 {
45  catchsql { SELECT a FROM (SELECT * FROM t1) AS t ON b }
46} {1 {a JOIN clause is required before ON}}
47do_test tkt3935.8 {
48  catchsql { SELECT a FROM t1 AS t ON b }
49} {1 {a JOIN clause is required before ON}}
50do_test tkt3935.9 {
51  catchsql { SELECT a FROM t1 AS t ON b USING(a) }
52} {1 {a JOIN clause is required before ON}}
53do_test tkt3935.10 {
54  catchsql { SELECT a FROM t1 AS t USING(a) }
55} {1 {a JOIN clause is required before USING}}
56
57finish_test
58