# 2022-04-19
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file implements tests for JOINs.
#
# The test case output is all generated by PostgreSQL 14.  This test module
# was created as follows:
#
#   1.   Run a TCL script (included at the bottom of this file) that
#        generates an input script for "psql" that will run man
#        diverse tests on joins.
#
#   2.   Run the script from step (1) through psql and collect the
#        output.
#
#   3.   Make a few minor global search-and-replace operations to convert
#        the psql output into a form suitable for this test module.
#
#   4.   Add this header, and the script content at the footer.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
db nullvalue -
db eval {
  DROP TABLE IF EXISTS t1;
  DROP TABLE IF EXISTS t2;
  DROP TABLE IF EXISTS t3;
  DROP TABLE IF EXISTS t4;
  DROP TABLE IF EXISTS t5;
  CREATE TABLE t1(a INT, b INT, c INT);
  CREATE TABLE t2(a INT, b INT, d INT);
  CREATE TABLE t3(a INT, b INT, e INT);
  CREATE TABLE t4(a INT, b INT, f INT);
  CREATE TABLE t5(a INT, b INT, g INT);
  INSERT INTO t1 VALUES(11,21,31),(12,22,32),(15,25,35),(17,27,37);
  INSERT INTO t2 VALUES(12,22,32),(13,23,33),(15,25,35),(18,28,38),
                       (NULL,NULL,36);
  INSERT INTO t4 VALUES(11,21,31),(13,23,33),(15,25,35),(19,29,39);
  INSERT INTO t3 SELECT * FROM t1 UNION SELECT * FROM t2 UNION SELECT * FROM t4;
  INSERT INTO t5 SELECT * FROM t3 WHERE a>=15;
}
do_execsql_test joinC-1 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-2 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-3 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-4 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-5 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-6 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-7 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-8 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-9 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-10 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-11 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-12 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-13 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-14 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-15 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-16 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-17 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-18 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-19 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-20 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-21 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-22 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-23 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-24 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-25 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-26 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-27 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-28 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-29 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-30 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-31 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-32 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-33 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-34 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  15 15 15 15 15 15

}
do_execsql_test joinC-35 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-36 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-37 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-38 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-39 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-40 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-41 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-42 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  15 15 15 15 15 15

}
do_execsql_test joinC-43 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-44 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-45 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-46 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-47 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-48 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-49 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-50 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-51 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-52 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-53 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-54 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-55 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-56 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-57 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-58 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15

}
do_execsql_test joinC-59 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-60 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-61 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-62 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-63 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-64 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 INNER JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-65 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-66 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-67 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-68 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-69 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-70 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-71 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-72 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-73 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-74 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-75 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-76 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-77 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-78 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-79 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-80 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-81 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-82 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-83 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-84 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-85 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-86 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-87 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-88 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-89 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-90 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-91 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-92 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-93 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-94 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-95 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-96 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-97 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-98 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-99 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-100 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-101 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-102 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-103 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-104 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-105 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-106 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-107 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-108 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-109 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-110 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-111 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-112 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-113 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-114 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-115 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-116 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-117 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-118 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-119 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-120 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-121 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-122 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-123 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-124 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-125 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-126 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -

}
do_execsql_test joinC-127 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11  -  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-128 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 LEFT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12 12 12  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17

}
do_execsql_test joinC-129 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-130 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  13  - 13 13 13  -
  15 15 15 15 15 15

}
do_execsql_test joinC-131 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-132 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-133 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-134 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-135 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-136 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-137 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15

}
do_execsql_test joinC-138 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  13  - 13 13 13  -
  15 15 15 15 15 15

}
do_execsql_test joinC-139 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-140 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-141 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-142 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-143 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-144 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-145 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  18  - 18  -  -  -

}
do_execsql_test joinC-146 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18  -  -  -

}
do_execsql_test joinC-147 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-148 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-149 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-150 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-151 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-152 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-153 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  18  - 18  -  -  -

}
do_execsql_test joinC-154 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18  -  -  -

}
do_execsql_test joinC-155 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-156 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-157 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-158 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  -  -

}
do_execsql_test joinC-159 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-160 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18 18  - 18

}
do_execsql_test joinC-161 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  19  -  - 19 19 19

}
do_execsql_test joinC-162 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  19  -  - 19 19 19

}
do_execsql_test joinC-163 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-164 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-165 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-166 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-167 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-168 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-169 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  19  -  - 19 19 19

}
do_execsql_test joinC-170 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  19  -  - 19 19 19

}
do_execsql_test joinC-171 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-172 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-173 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-174 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-175 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-176 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-177 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-178 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-179 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-180 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-181 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-182 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-183 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-184 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-185 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-186 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-187 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-188 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-189 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-190 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-191 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-192 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 RIGHT JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-193 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-194 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-195 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-196 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-197 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-198 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-199 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-200 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-201 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-202 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -

}
do_execsql_test joinC-203 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-204 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-205 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-206 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-207 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-208 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 INNER JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-209 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -

}
do_execsql_test joinC-210 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -

}
do_execsql_test joinC-211 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-212 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-213 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-214 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-215 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-216 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-217 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -

}
do_execsql_test joinC-218 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -

}
do_execsql_test joinC-219 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-220 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-221 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-222 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  -  -

}
do_execsql_test joinC-223 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-224 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 LEFT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18 18  - 18

}
do_execsql_test joinC-225 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-226 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-227 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-228 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-229 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-230 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-231 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-232 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-233 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-234 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-235 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  -  -  -  -
  12 12  -  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-236 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
  11 11  - 11 11  -
  12 12  -  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-237 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-238 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-239 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-240 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 RIGHT JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-241 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-242 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-243 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-244 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 INNER JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-245 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-246 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-247 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-248 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 LEFT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-249 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-250 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  -  -  -  -
  18  - 18  -  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-251 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  -  -  -  -
  12 12 12  -  -  -
  13  - 13  -  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-252 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 RIGHT JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12  -  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-253 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 INNER JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-254 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 LEFT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  -  -
  18  - 18 18  -  -
  19  -  - 19 19 19

}
do_execsql_test joinC-255 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 RIGHT JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11  -  -
  12 12 12 12  -  -
  13  - 13 13  -  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
do_execsql_test joinC-256 {
  SELECT a, t1.a, t2.a, t3.a, t4.a, t5.a
  FROM t1 FULL JOIN (
  t2 FULL JOIN (
  t3 FULL JOIN (
  t4 FULL JOIN t5 USING(a)
  ) USING(a)
  ) USING(a)
  ) USING(a)
  ORDER BY 1 NULLS FIRST;
} {
   -  -  -  -  -  -
   -  -  -  -  -  -
  11 11  - 11 11  -
  12 12 12 12  -  -
  13  - 13 13 13  -
  15 15 15 15 15 15
  17 17  - 17  - 17
  18  - 18 18  - 18
  19  -  - 19 19 19

}
finish_test