[Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 in test/sql-tap

sergeyb at tarantool.org sergeyb at tarantool.org
Thu Jan 21 15:50:15 MSK 2021


From: Sergey Bronnikov <sergeyb at tarantool.org>

W612 (A line contains trailing whitespace)
W613 (Trailing whitespace in a string)
W614 (Trailing whitespace in a comment)

Note: changes were made automatically in vim with regexp "%s/\s\+$//e".

Part of #5464
---
 .luacheckrc                          |   6 --
 test/sql-tap/aggnested.test.lua      |   8 +--
 test/sql-tap/alias.test.lua          |   4 +-
 test/sql-tap/alter.test.lua          |   2 +-
 test/sql-tap/analyze1.test.lua       |   4 +-
 test/sql-tap/analyze3.test.lua       |  52 +++++++-------
 test/sql-tap/analyze4.test.lua       |   6 +-
 test/sql-tap/analyze5.test.lua       |   6 +-
 test/sql-tap/analyze8.test.lua       |   8 +--
 test/sql-tap/analyze9.test.lua       | 100 +++++++++++++--------------
 test/sql-tap/analyzeD.test.lua       |  16 ++---
 test/sql-tap/analyzeF.test.lua       |   2 +-
 test/sql-tap/atof1.test.lua          |   2 +-
 test/sql-tap/autoinc.test.lua        |   2 +-
 test/sql-tap/autoindex4.test.lua     |   6 +-
 test/sql-tap/colname.test.lua        |   6 +-
 test/sql-tap/contrib01.test.lua      |   4 +-
 test/sql-tap/date.test.lua           |   4 +-
 test/sql-tap/default.test.lua        |  12 ++--
 test/sql-tap/delete3.test.lua        |   2 +-
 test/sql-tap/delete4.test.lua        |  14 ++--
 test/sql-tap/distinct.test.lua       |   6 +-
 test/sql-tap/e_delete.test.lua       |   2 +-
 test/sql-tap/e_expr.test.lua         |  12 ++--
 test/sql-tap/e_select1.test.lua      |   4 +-
 test/sql-tap/eqp.test.lua            |  50 +++++++-------
 test/sql-tap/func5.test.lua          |   2 +-
 test/sql-tap/icu.test.lua            |   8 +--
 test/sql-tap/in1.test.lua            |  48 ++++++-------
 test/sql-tap/in2.test.lua            |  12 ++--
 test/sql-tap/in3.test.lua            |  34 ++++-----
 test/sql-tap/in4.test.lua            |  56 +++++++--------
 test/sql-tap/index3.test.lua         |   6 +-
 test/sql-tap/index4.test.lua         |  14 ++--
 test/sql-tap/insert1.test.lua        |   8 +--
 test/sql-tap/insert3.test.lua        |   2 +-
 test/sql-tap/join.test.lua           |  25 +++----
 test/sql-tap/join3.test.lua          |   4 +-
 test/sql-tap/join6.test.lua          |   2 +-
 test/sql-tap/keyword1.test.lua       |   2 +-
 test/sql-tap/limit.test.lua          |  24 +++----
 test/sql-tap/minmax3.test.lua        |  32 ++++-----
 test/sql-tap/minmax4.test.lua        |   4 +-
 test/sql-tap/misc1.test.lua          |   8 +--
 test/sql-tap/misc5.test.lua          |  52 +++++++-------
 test/sql-tap/null.test.lua           |  10 +--
 test/sql-tap/offset1.test.lua        |   8 +--
 test/sql-tap/orderby1.test.lua       |  10 +--
 test/sql-tap/orderby6.test.lua       |  34 ++++-----
 test/sql-tap/orderby9.test.lua       |   4 +-
 test/sql-tap/resolver01.test.lua     |   8 +--
 test/sql-tap/select1.test.lua        |  50 +++++++-------
 test/sql-tap/select3.test.lua        |  30 ++++----
 test/sql-tap/select4.test.lua        |  30 ++++----
 test/sql-tap/select5.test.lua        |   6 +-
 test/sql-tap/select6.test.lua        |  32 ++++-----
 test/sql-tap/select7.test.lua        |   8 +--
 test/sql-tap/select8.test.lua        |  24 +++----
 test/sql-tap/select9.test.lua        |  28 ++++----
 test/sql-tap/selectB.test.lua        |  72 +++++++++----------
 test/sql-tap/selectC.test.lua        |   6 +-
 test/sql-tap/selectE.test.lua        |  16 ++---
 test/sql-tap/selectF.test.lua        |   8 +--
 test/sql-tap/subquery.test.lua       |  30 ++++----
 test/sql-tap/subquery2.test.lua      |   8 +--
 test/sql-tap/subselect.test.lua      |   4 +-
 test/sql-tap/table.test.lua          |  42 +++++------
 test/sql-tap/tkt-02a8e81d44.test.lua |   2 +-
 test/sql-tap/tkt-31338dca7e.test.lua |   2 +-
 test/sql-tap/tkt-385a5b56b9.test.lua |   4 +-
 test/sql-tap/tkt-3a77c9714e.test.lua |   6 +-
 test/sql-tap/tkt-4a03edc4c8.test.lua |   2 +-
 test/sql-tap/tkt-4dd95f6943.test.lua |  16 ++---
 test/sql-tap/tkt-54844eea3f.test.lua |   6 +-
 test/sql-tap/tkt-752e1646fc.test.lua |   8 +--
 test/sql-tap/tkt-7bbfb7d442.test.lua |  14 ++--
 test/sql-tap/tkt-80ba201079.test.lua |   4 +-
 test/sql-tap/tkt-8c63ff0ec.test.lua  |   4 +-
 test/sql-tap/tkt-91e2e8ba6f.test.lua |   6 +-
 test/sql-tap/tkt-a8a0d2996a.test.lua |   2 +-
 test/sql-tap/tkt-ba7cbfaedc.test.lua |   4 +-
 test/sql-tap/tkt-bd484a090c.test.lua |   2 +-
 test/sql-tap/tkt-f973c7ac31.test.lua |   6 +-
 test/sql-tap/tkt-fa7bf5ec.test.lua   |   6 +-
 test/sql-tap/tkt1443.test.lua        |   6 +-
 test/sql-tap/tkt1444.test.lua        |   2 +-
 test/sql-tap/tkt1449.test.lua        |   2 +-
 test/sql-tap/tkt1473.test.lua        |   8 +--
 test/sql-tap/tkt1501.test.lua        |   2 +-
 test/sql-tap/tkt1514.test.lua        |   2 +-
 test/sql-tap/tkt1537.test.lua        |   2 +-
 test/sql-tap/tkt2141.test.lua        |   2 +-
 test/sql-tap/tkt2192.test.lua        |   4 +-
 test/sql-tap/tkt2391.test.lua        |   4 +-
 test/sql-tap/tkt2640.test.lua        |   2 +-
 test/sql-tap/tkt2822.test.lua        |  46 ++++++------
 test/sql-tap/tkt2927.test.lua        |  64 ++++++++---------
 test/sql-tap/tkt2942.test.lua        |   2 +-
 test/sql-tap/tkt3201.test.lua        |   6 +-
 test/sql-tap/tkt3298.test.lua        |   2 +-
 test/sql-tap/tkt3357.test.lua        |   8 +--
 test/sql-tap/tkt3424.test.lua        |  10 +--
 test/sql-tap/tkt3442.test.lua        |   4 +-
 test/sql-tap/tkt3493.test.lua        |  68 +++++++++---------
 test/sql-tap/tkt3554.test.lua        |   2 +-
 test/sql-tap/tkt3581.test.lua        |   4 +-
 test/sql-tap/tkt3935.test.lua        |  17 +++--
 test/sql-tap/tokenize.test.lua       |   2 +-
 test/sql-tap/transitive1.test.lua    |   4 +-
 test/sql-tap/triggerB.test.lua       |  10 +--
 test/sql-tap/types2.test.lua         |   8 +--
 test/sql-tap/update.test.lua         |  28 ++++----
 test/sql-tap/view.test.lua           |   8 +--
 test/sql-tap/where2.test.lua         |  34 ++++-----
 test/sql-tap/where3.test.lua         |  50 +++++++-------
 test/sql-tap/where4.test.lua         |  16 ++---
 test/sql-tap/where6.test.lua         |   6 +-
 test/sql-tap/where7.test.lua         |  10 +--
 test/sql-tap/whereD.test.lua         |   6 +-
 test/sql-tap/whereF.test.lua         |   8 +--
 test/sql-tap/whereG.test.lua         |   8 +--
 test/sql-tap/whereI.test.lua         |   6 +-
 test/sql-tap/with1.test.lua          |  54 +++++++--------
 test/sql-tap/with2.test.lua          |  40 +++++------
 124 files changed, 907 insertions(+), 905 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 98e7cb9bb..69be93a67 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -53,12 +53,6 @@ files["test/sql-tap/**/*.lua"] = {
     ignore = {
         -- A line consists of nothing but whitespace.
         "611",
-        -- A line contains trailing whitespace.
-        "612",
-        -- Trailing whitespace in a string.
-        "613",
-        -- Trailing whitespace in a comment.
-        "614",
         -- Inconsistent indentation (SPACE followed by TAB).
         "621",
         -- Line is too long.
diff --git a/test/sql-tap/aggnested.test.lua b/test/sql-tap/aggnested.test.lua
index 37471f48a..6a967461d 100755
--- a/test/sql-tap/aggnested.test.lua
+++ b/test/sql-tap/aggnested.test.lua
@@ -15,7 +15,7 @@ test:plan(7)
 -------------------------------------------------------------------------
 -- This file implements regression tests for sql library.
 --
--- This file implements tests for processing aggregate queries with 
+-- This file implements tests for processing aggregate queries with
 -- subqueries in which the subqueries hold the aggregate functions
 -- or in which the subqueries are themselves aggregate queries
 --
@@ -74,17 +74,17 @@ test:do_execsql_test("aggnested-1.4",
 -- #
 -- do_test aggnested-2.0 {
 --   db2 eval {
---     CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT 
+--     CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT
 --     NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1));
 --     REPLACE INTO t1 VALUES(1,11,111,1111);
 --     REPLACE INTO t1 VALUES(2,22,222,2222);
 --     REPLACE INTO t1 VALUES(3,33,333,3333);
---     CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGER NOT 
+--     CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGER NOT
 --     NULL,B4 INTEGER NOT NULL,PRIMARY KEY(B1));
 --     REPLACE INTO t2 VALUES(1,88,888,8888);
 --     REPLACE INTO t2 VALUES(2,99,999,9999);
 --     SELECT (SELECT GROUP_CONCAT(CASE WHEN a1=1 THEN'A' ELSE 'B' END) FROM t2),
---             t1.* 
+--             t1.*
 --     FROM t1;
 --   }
 -- } {A,B,B 3 33 333 3333}
diff --git a/test/sql-tap/alias.test.lua b/test/sql-tap/alias.test.lua
index 27a611d19..40078dcee 100755
--- a/test/sql-tap/alias.test.lua
+++ b/test/sql-tap/alias.test.lua
@@ -95,8 +95,8 @@ test:do_test(
 --     function()
 --         counter = 0
 --         return test:execsql([[
---             SELECT x, sequence() AS y FROM t1 
---              WHERE y>0 AND y<99 AND y!=55 AND y NOT IN (56,57,58) 
+--             SELECT x, sequence() AS y FROM t1
+--              WHERE y>0 AND y<99 AND y!=55 AND y NOT IN (56,57,58)
 --                AND y NOT LIKE 'abc%' AND y%10==2 order by x desc
 --         ]])
 --     end, {
diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua
index 2fece6649..9ed09b41c 100755
--- a/test/sql-tap/alter.test.lua
+++ b/test/sql-tap/alter.test.lua
@@ -49,7 +49,7 @@ test:do_execsql_test(
     [[
         SELECT 't1', * FROM "t1";
         SELECT 't2', * FROM t2;
-        SELECT 'space_table', * FROM SPACE_TABLE;  
+        SELECT 'space_table', * FROM SPACE_TABLE;
     ]], {
         -- <alter-1.4>
         "space_table", 1, 5, 6, 7
diff --git a/test/sql-tap/analyze1.test.lua b/test/sql-tap/analyze1.test.lua
index 18770a086..3a2539a5d 100755
--- a/test/sql-tap/analyze1.test.lua
+++ b/test/sql-tap/analyze1.test.lua
@@ -252,7 +252,7 @@ test:do_execsql_test(
         DROP TABLE t2;
         SELECT "idx", "stat" FROM "_sql_stat1" ORDER BY "idx";
     ]], {
-        -- <analyze-3.8>      
+        -- <analyze-3.8>
         -- </analyze-3.8>
     })
 
@@ -348,7 +348,7 @@ test:do_execsql_test(
 
 
 
--- Verify that DROP TABLE and DROP INDEX remove entries from the 
+-- Verify that DROP TABLE and DROP INDEX remove entries from the
 -- sql_stat1, sql_stat3 and sql_stat4 tables.
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/analyze3.test.lua b/test/sql-tap/analyze3.test.lua
index 5f0b24fea..a7b6ba2f6 100755
--- a/test/sql-tap/analyze3.test.lua
+++ b/test/sql-tap/analyze3.test.lua
@@ -21,15 +21,15 @@ test:plan(37)
 ------------------------------------------------------------------------
 -- Test Organization:
 --
--- analyze3-1.*: Test that the values of bound parameters are considered 
+-- analyze3-1.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use range constraints.
 --
--- analyze3-2.*: Test that the values of bound parameters are considered 
+-- analyze3-2.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use LIKE expressions in the WHERE clause.
 --
--- analyze3-3.*: Test that binding to a variable does not invalidate the 
+-- analyze3-3.*: Test that binding to a variable does not invalidate the
 --               query plan when there is no way in which replanning the
 --               query may produce a superior outcome.
 --
@@ -39,23 +39,23 @@ test:plan(37)
 -- analyze3-5.*: Check that the query plans of applicable statements are
 --               invalidated if the values of SQL parameter are modified
 --               using the clear_bindings() or transfer_bindings() APIs.
--- 
+--
 -- analyze3-6.*: Test that the problem fixed by commit [127a5b776d] is fixed.
 --
--- analyze3-7.*: Test that some memory leaks discovered by fuzz testing 
+-- analyze3-7.*: Test that some memory leaks discovered by fuzz testing
 --               have been fixed.
 --
 
 ---------------------------------------------------------------------------
 --
--- analyze3-1.1.1: 
---   Create a table with two columns. Populate the first column (affinity 
---   INTEGER) with integer values from 100 to 1100. Create an index on this 
+-- analyze3-1.1.1:
+--   Create a table with two columns. Populate the first column (affinity
+--   INTEGER) with integer values from 100 to 1100. Create an index on this
 --   column. ANALYZE the table.
 --
 -- analyze3-1.1.2 - 3.1.3
 --   Show that there are two possible plans for querying the table with
---   a range constraint on the indexed column - "full table scan" or "use 
+--   a range constraint on the indexed column - "full table scan" or "use
 --   the index". When the range is specified using literal values, sql
 --   is able to pick the best plan based on the samples in sql_stat3.
 --
@@ -63,8 +63,8 @@ test:plan(37)
 --   Show that using SQL variables produces the same results as using
 --   literal values to constrain the range scan.
 --
---   These tests also check that the compiler code considers column 
---   affinities when estimating the number of rows scanned by the "use 
+--   These tests also check that the compiler code considers column
+--   affinities when estimating the number of rows scanned by the "use
 --   index strategy".
 --
 test:do_test(
@@ -112,7 +112,7 @@ test:do_execsql_test(
     })
 
 -- The first of the following two SELECT statements visits 99 rows. So
--- it is better to use the index. But the second visits every row in 
+-- it is better to use the index. But the second visits every row in
 -- the table (1000 in total) so it is better to do a full-table scan.
 --
 test:do_eqp_test(
@@ -128,7 +128,7 @@ test:do_eqp_test(
 test:do_eqp_test(
     "analyze3-1.1.3",
     [[
-        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100 
+        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100
     ]], {
         -- Tarantool: index is always covering, thus there is no need to scan table.
         -- <analyze3-1.1.3>
@@ -140,7 +140,7 @@ test:do_eqp_test(
 test:do_sf_execsql_test(
     "analyze3-1.1.4",
     [[
-        SELECT sum(y) FROM t1 WHERE x>200 AND x<300 
+        SELECT sum(y) FROM t1 WHERE x>200 AND x<300
     ]], {
         -- <analyze3-1.1.4>
         -- 199, 0, 14850
@@ -173,7 +173,7 @@ test:do_test(
 test:do_sf_execsql_test(
     "analyze3-1.1.7",
     [[
-        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100 
+        SELECT sum(y) FROM t1 WHERE x>0 AND x<1100
     ]], {
         -- <analyze3-1.1.7>
         1000, {499500}
@@ -215,7 +215,7 @@ test:do_execsql_test(
         ANALYZE;
     ]], {
         -- <analyze3-1.2.1>
-        
+
         -- </analyze3-1.2.1>
     })
 
@@ -267,7 +267,7 @@ test:do_eqp_test(
  test:do_sf_execsql_test(
     "analyze3-1.2.4",
     [[
-        SELECT sum(y) FROM t2 WHERE x>12 AND x<20 
+        SELECT sum(y) FROM t2 WHERE x>12 AND x<20
     ]], {
         -- <analyze3-1.2.4>
         999, {""}
@@ -297,7 +297,7 @@ test:do_test(
 test:do_sf_execsql_test(
     "analyze3-1.2.7",
     [[
-        SELECT sum(y) FROM t2 WHERE x>0 AND x<99 
+        SELECT sum(y) FROM t2 WHERE x>0 AND x<99
     ]], {
         -- <analyze3-1.2.7>
         999, {""}
@@ -339,7 +339,7 @@ test:do_execsql_test(
         ANALYZE;
     ]], {
         -- <analyze3-1.3.1>
-        
+
         -- </analyze3-1.3.1>
     })
 
@@ -389,7 +389,7 @@ test:do_eqp_test(
 test:do_sf_execsql_test(
     "analyze3-1.3.4",
     [[
-        SELECT sum(y) FROM t3 WHERE x>200 AND x<300 
+        SELECT sum(y) FROM t3 WHERE x>200 AND x<300
     ]], {
         -- <analyze3-1.3.4>
         100, {14850}
@@ -419,7 +419,7 @@ test:do_test(
 test:do_sf_execsql_test(
     "analyze3-1.3.7",
     [[
-        SELECT sum(y) FROM t3 WHERE x>0 AND x<1100 
+        SELECT sum(y) FROM t3 WHERE x>0 AND x<1100
     ]], {
         -- <analyze3-1.3.7>
         1000, {499500}
@@ -471,7 +471,7 @@ test:do_test(
 --         return test:execsql("COMMIT")
 --     end, {
 --         -- <analyze3-2.1>
-        
+
 --         -- </analyze3-2.1>
 --     })
 
@@ -498,7 +498,7 @@ test:do_test(
 -- test:do_sf_execsql_test(
 --     "analyze3-2.4",
 --     [[
---         SELECT count(*) FROM t1 WHERE b LIKE 'a%' 
+--         SELECT count(*) FROM t1 WHERE b LIKE 'a%'
 --     ]], {
 --         -- <analyze3-2.4>
 --         102, 0, 100
@@ -508,7 +508,7 @@ test:do_test(
 -- test:do_sf_execsql_test(
 --     "analyze3-2.5",
 --     [[
---         SELECT count(*) FROM t1 WHERE b LIKE '%a' 
+--         SELECT count(*) FROM t1 WHERE b LIKE '%a'
 --     ]], {
 --         -- <analyze3-2.5>
 --         999, 999, 100
@@ -601,7 +601,7 @@ test:do_test(
         return test:execsql("ANALYZE")
     end, {
         -- <analyze3-6.1>
-        
+
         -- </analyze3-6.1>
     })
 
@@ -640,7 +640,7 @@ test:do_execsql_test(
         SELECT c FROM t1 WHERE b=3 AND a BETWEEN 30 AND hex(1);
     ]], {
         -- <analyze-7.1>
-        
+
         -- </analyze-7.1>
     })
 
diff --git a/test/sql-tap/analyze4.test.lua b/test/sql-tap/analyze4.test.lua
index 8327b78c7..0970b3882 100755
--- a/test/sql-tap/analyze4.test.lua
+++ b/test/sql-tap/analyze4.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 --
 -- This file implements regression tests for sql library. This file
 -- implements tests for ANALYZE to verify that multiple rows containing
--- a NULL value count as distinct rows for the purposes of analyze 
+-- a NULL value count as distinct rows for the purposes of analyze
 -- statistics.
 --
 -- Also include test cases for collating sequences on indices.
@@ -62,7 +62,7 @@ test:do_execsql_test(
     })
 
 -- Change half of the b values from NULL to a constant.  Verify
--- that the number of rows selected in stat1 is half the total 
+-- that the number of rows selected in stat1 is half the total
 -- number of rows.
 --
 test:do_test(
@@ -82,7 +82,7 @@ test:do_test(
     })
 
 -- Change the t1.b values all back to NULL.  Add columns t1.c and t1.d.
--- Create a multi-column indices using t1.b and verify that ANALYZE 
+-- Create a multi-column indices using t1.b and verify that ANALYZE
 -- processes them correctly.
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
index d53648919..91af12529 100755
--- a/test/sql-tap/analyze5.test.lua
+++ b/test/sql-tap/analyze5.test.lua
@@ -65,7 +65,7 @@ test:do_test(
             if  i >= 875 then
                 z = z + 1
             end
-            
+
             local x, w, t, u
             x = z
             w = z
@@ -116,7 +116,7 @@ test:do_test(
 --     "analyze5-1.1",
 --     function()
 --         return test:execsql([[
---             SELECT DISTINCT lower(lindex(test_decode(sample), 0)) 
+--             SELECT DISTINCT lower(lindex(test_decode(sample), 0))
 --               FROM _sql_stat4 WHERE idx='t1v' ORDER BY 1
 --         ]])
 
@@ -222,7 +222,7 @@ for i, v in pairs({
 {'y=1',                t1y,   26},
 {'y=0.1',              t1y,    1},
 
-{'x IS NULL',          t1x,  400},        
+{'x IS NULL',          t1x,  400},
                  }) do
     -- Verify that the expected index is used with the expected row count
     -- No longer valid due to an EXPLAIN QUERY PLAN output format change
diff --git a/test/sql-tap/analyze8.test.lua b/test/sql-tap/analyze8.test.lua
index cf40ce7bb..76f9c57cb 100755
--- a/test/sql-tap/analyze8.test.lua
+++ b/test/sql-tap/analyze8.test.lua
@@ -51,7 +51,7 @@ test:do_test(
         end
         return test:execsql("ANALYZE")
     end, {
-        -- <1.0>        
+        -- <1.0>
         -- </1.0>
     })
 
@@ -60,7 +60,7 @@ test:do_test(
 
 -- But for a==99 and a==101, there are far fewer rows so choose
 -- the t1a index.
-    
+
 test:do_eqp_test(
     1.1,
     [[SELECT * FROM t1 WHERE a=100 AND b=55]],
@@ -127,12 +127,12 @@ test:do_eqp_test(
 -- There are many more values of c between 0 and 100000 than there are
 -- between 800000 and 900000.  So t1c is more selective for the latter
 -- range.
--- 
+--
 -- Test 3.2 is a little unstable. It depends on the planner estimating
 -- that (b BETWEEN 30 AND 34) will match more rows than (c BETWEEN
 -- 800000 AND 900000). Which is a pretty close call (50 vs. 32), so
 -- the planner could get it wrong with an unlucky set of samples. This
--- case happens to work, but others ("b BETWEEN 40 AND 44" for example) 
+-- case happens to work, but others ("b BETWEEN 40 AND 44" for example)
 -- will fail.
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 7a24d6752..06e6ae070 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -23,7 +23,7 @@ test:do_execsql_test(
     1.0,
     [[
         DROP TABLE IF EXISTS t1;
-        CREATE TABLE t1(a TEXT PRIMARY KEY, b TEXT); 
+        CREATE TABLE t1(a TEXT PRIMARY KEY, b TEXT);
         INSERT INTO t1 VALUES('(0)', '(0)');
         INSERT INTO t1 VALUES('(1)', '(1)');
         INSERT INTO t1 VALUES('(2)', '(2)');
@@ -51,7 +51,7 @@ local function msgpack_decode_sample(txt)
     while msgpack.decode(txt)[i] ~= nil do
         if i == 1 then
             decoded_str = msgpack.decode(txt)[i]
-        else 
+        else
             decoded_str = decoded_str.." "..msgpack.decode(txt)[i]
         end
         i = i+1
@@ -71,8 +71,8 @@ test:do_execsql_test(
         SELECT "tbl","idx","neq","nlt","ndlt",msgpack_decode_sample("sample") FROM "_sql_stat4" where "idx" = 'I1';
     ]], {
         -- <1.2>
-        "T1", "I1", "1 1", "0 0", "0 0", "(0) (0)", "T1", "I1", "1 1", "1 1", "1 1", "(1) (1)", 
-        "T1", "I1", "1 1", "2 2", "2 2", "(2) (2)", "T1", "I1", "1 1", "3 3", "3 3", "(3) (3)", 
+        "T1", "I1", "1 1", "0 0", "0 0", "(0) (0)", "T1", "I1", "1 1", "1 1", "1 1", "(1) (1)",
+        "T1", "I1", "1 1", "2 2", "2 2", "(2) (2)", "T1", "I1", "1 1", "3 3", "3 3", "(3) (3)",
         "T1", "I1", "1 1", "4 4", "4 4", "(4) (4)"
         -- </1.2>
     })
@@ -84,8 +84,8 @@ test:do_execsql_test(
 
     ]], {
         -- <1.3>
-        'T1', 'T1', '1', '0', '0', '(0)', 'T1', 'T1', '1', '1', '1', '(1)', 
-        'T1', 'T1', '1', '2', '2', '(2)', 'T1', 'T1', '1', '3', '3', '(3)', 
+        'T1', 'T1', '1', '0', '0', '(0)', 'T1', 'T1', '1', '1', '1', '(1)',
+        'T1', 'T1', '1', '2', '2', '(2)', 'T1', 'T1', '1', '3', '3', '(3)',
         'T1', 'T1', '1', '4', '4', '(4)'
         -- </1.3>
     })
@@ -148,7 +148,7 @@ local function lrange(str, first, last)
         if i >= first and i <= last then
             if i == first then
                 res_tokens = token
-            else 
+            else
                 res_tokens = res_tokens.." "..token
             end
         end
@@ -187,7 +187,7 @@ test:do_execsql_test(
     ]], generate_tens(100))
 
 -- The first element in the "nEq" list of all samples should therefore be 10.
---      
+--
 test:do_execsql_test(
     "3.3.2",
     [[
@@ -196,7 +196,7 @@ test:do_execsql_test(
     ]], generate_tens_str(24))
 
 ---------------------------------------------------------------------------
--- 
+--
 test:do_execsql_test(
     3.4,
     [[
@@ -227,7 +227,7 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- These tests verify that the sample selection for stat4 appears to be 
+-- These tests verify that the sample selection for stat4 appears to be
 -- working as designed.
 --
 test:do_execsql_test(
@@ -290,7 +290,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.3,
     [[
-        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3) 
+        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3)
             FROM "_sql_stat4" WHERE "idx" = 'I1' ORDER BY "sample" LIMIT 16;
     ]], {
         -- <4.3>
@@ -307,7 +307,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.4,
     [[
-        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3) 
+        SELECT "neq", lrange("nlt", 1, 3), lrange("ndlt", 1, 3), lrange(msgpack_decode_sample("sample"), 1, 3)
         FROM "_sql_stat4" WHERE "idx" = 'I1' ORDER BY "sample" DESC LIMIT 2;
     ]], {
         -- <4.4>
@@ -318,7 +318,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.5,
     [[
-        SELECT count(DISTINCT c) FROM t1 WHERE c<201 
+        SELECT count(DISTINCT c) FROM t1 WHERE c<201
     ]], {
         -- <4.5>
         120
@@ -328,7 +328,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     4.6,
     [[
-        SELECT count(DISTINCT c) FROM t1 WHERE c<200 
+        SELECT count(DISTINCT c) FROM t1 WHERE c<200
     ]], {
         -- <4.6>
         119
@@ -625,7 +625,7 @@ test:do_test(
     end
         return test:execsql("ANALYZE")
     end, {
-        -- <10.1.2>      
+        -- <10.1.2>
         -- </10.1.2>
     })
 
@@ -673,7 +673,7 @@ test:do_test(
     end
         return test:execsql("ANALYZE")
     end, {
-        -- <10.2.2>    
+        -- <10.2.2>
         -- </10.2.2>
     })
 
@@ -717,7 +717,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -732,7 +732,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "11.2", 
+    "11.2",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"def"' AND b = 3;
     ]], {
@@ -742,7 +742,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "11.3", 
+    "11.3",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"abc"' AND b = 3;
     ]], {
@@ -768,7 +768,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -783,7 +783,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "11.6", 
+    "11.6",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"def"' AND b = 3;
     ]], {
@@ -793,7 +793,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "11.7", 
+    "11.7",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a = '"abc"' COLLATE "unicode_ci" AND b = 3;
     ]], {
@@ -803,7 +803,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "11.8", 
+    "11.8",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE a COLLATE "unicode_ci" = '"abc"' AND b = 3;
     ]], {
@@ -829,7 +829,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -844,7 +844,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "12.2", 
+    "12.2",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a = '"def"' AND b = 3;
     ]], {
@@ -854,7 +854,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "12.3", 
+    "12.3",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a = '"abc"' AND b = 3;
     ]], {
@@ -880,7 +880,7 @@ test:do_test(
     function()
         local a
         for i = 0, 100 do
-            if i % 10 == 0 then 
+            if i % 10 == 0 then
                 a = "\"ABC\""
             else
                 a = "\"DEF\""
@@ -895,7 +895,7 @@ test:do_test(
     })
 
 test:do_execsql_test(
-    "12.6", 
+    "12.6",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a = 'def' AND b = 3;
     ]], {
@@ -905,7 +905,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "12.7", 
+    "12.7",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x= 'abcdef' AND a = '"abc"' COLLATE "unicode_ci" AND b = 3;
     ]], {
@@ -915,7 +915,7 @@ test:do_execsql_test(
     })
 
 test:do_execsql_test(
-    "12.8", 
+    "12.8",
     [[
         EXPLAIN QUERY PLAN SELECT * FROM t4 WHERE x = 'abcdef' AND a COLLATE "unicode_ci" = '"abc"' AND b = 3;
     ]], {
@@ -991,8 +991,8 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- Check also that affinities are taken into account when using stat4 data 
--- to estimate the number of rows scanned by any other constraint on a 
+-- Check also that affinities are taken into account when using stat4 data
+-- to estimate the number of rows scanned by any other constraint on a
 -- column other than the leftmost.
 --
 test:do_test(
@@ -1010,7 +1010,7 @@ test:do_test(
                 ANALYZE;
             ]])
         end, {
-        -- <14.1>    
+        -- <14.1>
         -- </14.1>
         })
 
@@ -1054,7 +1054,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     15.2,
     [[
-        SELECT * FROM x1; 
+        SELECT * FROM x1;
     ]], {
         -- <15.2>
         1, 2, 3, 4, 5, 6
@@ -1310,7 +1310,7 @@ test:do_test(
     function()
         for i = 1, 100 do
             test:execsql(string.format([[
-                INSERT INTO t2 VALUES(null, CASE WHEN %s < 80 THEN 'one' ELSE 'two' END, %s) 
+                INSERT INTO t2 VALUES(null, CASE WHEN %s < 80 THEN 'one' ELSE 'two' END, %s)
                 ]], i, i))
         end
         return test:execsql("ANALYZE")
@@ -1351,7 +1351,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     22.1,
     [[
-        WITH r(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM r WHERE x<=100) 
+        WITH r(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM r WHERE x<=100)
         INSERT INTO t3 SELECT CASE WHEN (x>45 AND x<96) THEN 'B' ELSE 'A' END,
             x, CASE WHEN (x<51) THEN 'one' ELSE 'two' END, x FROM r;
 
@@ -1436,8 +1436,8 @@ test:do_execsql_test(
     24.0,
     [[
         CREATE TABLE t5(c INT , d INT , b TEXT, e INT , a TEXT, PRIMARY KEY(a, b, c));
-        WITH data(a, b, c, d, e) AS (SELECT 'z', 'y', 0, 0, 0 UNION ALL 
-            SELECT a, CASE WHEN b='y' THEN 'n' ELSE 'y' END, c+1, e/250, e+1 FROM data WHERE e<1000) 
+        WITH data(a, b, c, d, e) AS (SELECT 'z', 'y', 0, 0, 0 UNION ALL
+            SELECT a, CASE WHEN b='y' THEN 'n' ELSE 'y' END, c+1, e/250, e+1 FROM data WHERE e<1000)
                 INSERT INTO t5(a, b, c, d, e) SELECT * FROM data;
         CREATE INDEX t5d ON t5(d);
         CREATE INDEX t5e ON t5(e);
@@ -1489,7 +1489,7 @@ test:do_execsql_test(
         DROP TABLE IF EXISTS t6;
         DROP TABLE IF EXISTS ints;
         CREATE TABLE t6(id INTEGER PRIMARY KEY AUTOINCREMENT, a INT , b INT );
-        WITH ints(i,j) AS (SELECT 1,1 UNION ALL SELECT i+1,j+1 FROM ints WHERE i<100) 
+        WITH ints(i,j) AS (SELECT 1,1 UNION ALL SELECT i+1,j+1 FROM ints WHERE i<100)
             INSERT INTO t6 SELECT null,* FROM ints;
         CREATE INDEX aa ON t6(a);
         CREATE INDEX bb ON t6(b);
@@ -1551,7 +1551,7 @@ test:do_execsql_test(
 
 
 ---------------------------------------------------------------------------
--- Check that a problem in they way stat4 data is used has been 
+-- Check that a problem in they way stat4 data is used has been
 -- resolved (see below).
 --
 -- Commented due to assertion(#2834)
@@ -1570,7 +1570,7 @@ test:do_test(
         for i = 0, 10 do
             test:execsql(string.format(
                 "WITH cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt WHERE x<100) INSERT INTO t1(id, x, y) SELECT null, %s, x FROM cnt;", i+10000))
-            test:execsql(string.format("INSERT INTO t1(id, x, y) SELECT null, %s, 100;", i+10000))    
+            test:execsql(string.format("INSERT INTO t1(id, x, y) SELECT null, %s, 100;", i+10000))
         end
         test:execsql([[
                 UPDATE t1 SET z = id / 20;
@@ -1608,7 +1608,7 @@ test:do_execsql_test(
 --
 --   sample=(x=10000, y=100) nLt=(10000 10099)
 --
--- There should be no other samples that start with (x=10000). So it knows 
+-- There should be no other samples that start with (x=10000). So it knows
 -- that (x=10000 AND y<50) must match somewhere between 0 and 99 rows, but
 -- know more than that. Guessing less than 20 is therefore unreasonable.
 --
@@ -1627,19 +1627,19 @@ test:do_execsql_test(
 
 -- This test - 26.2.* - tests that another manifestation of the same problem
 -- is no longer present in the library. Assuming:
--- 
+--
 --   CREATE INDEX t1xy ON t1(x, y)
 --
 -- and that have samples for index t1xy as follows:
 --
 --
 --   sample=('A', 70)        nEq=(100, 2)        nLt=(900, 970)
---   sample=('B', 70)        nEq=(100, 2)        nLt=(1000, 1070)    
+--   sample=('B', 70)        nEq=(100, 2)        nLt=(1000, 1070)
 --
 -- the planner should estimate that (x = 'B' AND y > 25) matches 76 rows
--- (70 * 2/3 + 30). Before, due to the problem, the planner was estimating 
+-- (70 * 2/3 + 30). Before, due to the problem, the planner was estimating
 -- that this matched 100 rows.
--- 
+--
 test:do_execsql_test(
     "26.2.1",
     [[
@@ -1649,14 +1649,14 @@ test:do_execsql_test(
         CREATE INDEX i2 ON t1(z);
 
 
-        WITH cnt(y) AS (SELECT 0 UNION ALL SELECT y+1 FROM cnt WHERE y<99), 
-            letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D') 
+        WITH cnt(y) AS (SELECT 0 UNION ALL SELECT y+1 FROM cnt WHERE y<99),
+            letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')
                 INSERT INTO t1(id, x, y) SELECT null, x, y FROM letters, cnt;
 
-        WITH letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D') 
+        WITH letters(x) AS (SELECT 'A' UNION SELECT 'B' UNION SELECT 'C' UNION SELECT 'D')
             INSERT INTO t1(id, x, y) SELECT null, x, 70 FROM letters;
 
-        WITH cnt(i) AS (SELECT 407 UNION ALL SELECT i+1 FROM cnt WHERE i<9999) 
+        WITH cnt(i) AS (SELECT 407 UNION ALL SELECT i+1 FROM cnt WHERE i<9999)
             INSERT INTO t1(id, x, y) SELECT i, i, i FROM cnt;
 
         UPDATE t1 SET z = (id / 95);
diff --git a/test/sql-tap/analyzeD.test.lua b/test/sql-tap/analyzeD.test.lua
index 12722a3d4..e0426b974 100755
--- a/test/sql-tap/analyzeD.test.lua
+++ b/test/sql-tap/analyzeD.test.lua
@@ -54,7 +54,7 @@ test:do_test(
 			ANALYZE;
 		]])
 	end, {
-        	-- <1.1> 
+        	-- <1.1>
         	-- </1.1>
     })
 
@@ -101,7 +101,7 @@ test:do_execsql_test(
 		UPDATE t1 SET a=13 WHERE a = 3001;
 		ANALYZE;
 	]], {
-        -- <1.5> 
+        -- <1.5>
         -- </1.5>
     })
 
@@ -120,11 +120,11 @@ test:do_test(
 	function()
 		test:execsql(" DELETE FROM \"_sql_stat1\" ")
 	end, {
-        -- <1.7> 
+        -- <1.7>
         -- </1.7>
    	})
 
--- Same test as 1.4, except this time the 7 rows that match the a=? condition 
+-- Same test as 1.4, except this time the 7 rows that match the a=? condition
 -- do not feature larger values than all rows in the stat4 table. So sql
 -- gets this right, even without stat1 data.
 test:do_execsql_test(
@@ -155,7 +155,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat4" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.10>
-		
+
 		-- <analyzeD-1.10>
 	})
 
@@ -165,7 +165,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat1" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.11>
-		
+
 		-- <analyzeD-1.11>
 	})
 
@@ -185,7 +185,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat4" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.13>
-		
+
 		-- <analyzeD-1.13>
 	})
 
@@ -195,7 +195,7 @@ test:do_execsql_test(
 		SELECT * FROM "_sql_stat1" WHERE "tbl" = 'v';
 	]], {
 		-- <analyzeD-1.14>
-		
+
 		-- <analyzeD-1.14>
 	})
 
diff --git a/test/sql-tap/analyzeF.test.lua b/test/sql-tap/analyzeF.test.lua
index 19bb2176f..0b621a3ae 100755
--- a/test/sql-tap/analyzeF.test.lua
+++ b/test/sql-tap/analyzeF.test.lua
@@ -98,7 +98,7 @@ test:do_catchsql_test(
 -- Check that functions that accept zero arguments do not cause problems.
 --
 
-local function det4() 
+local function det4()
     return 4
 end
 
diff --git a/test/sql-tap/atof1.test.lua b/test/sql-tap/atof1.test.lua
index 78aca6557..92fcb0e9d 100755
--- a/test/sql-tap/atof1.test.lua
+++ b/test/sql-tap/atof1.test.lua
@@ -13,7 +13,7 @@ test:plan(9999)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Tests of the sqlAtoF() function.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/autoinc.test.lua b/test/sql-tap/autoinc.test.lua
index 3f8000abd..aa457b502 100755
--- a/test/sql-tap/autoinc.test.lua
+++ b/test/sql-tap/autoinc.test.lua
@@ -613,7 +613,7 @@ test:do_catchsql_test(
     [[
             DROP TABLE IF EXISTS t2;
             CREATE TABLE t2(x INT PRIMARY KEY AUTOINCREMENT);
-            INSERT INTO t2 VALUES('asd'); 
+            INSERT INTO t2 VALUES('asd');
     ]], {
         -- <autoinc-10.2>
         1, "Type mismatch: can not convert asd to integer"
diff --git a/test/sql-tap/autoindex4.test.lua b/test/sql-tap/autoindex4.test.lua
index c2ca723b8..2c800969a 100755
--- a/test/sql-tap/autoindex4.test.lua
+++ b/test/sql-tap/autoindex4.test.lua
@@ -41,7 +41,7 @@ test:do_execsql_test(
         SELECT *, '|' FROM t1, t2 WHERE a=234 AND x=555;
     ]], {
         -- <autoindex4-1.1>
-        
+
         -- </autoindex4-1.1>
     })
 
@@ -71,7 +71,7 @@ test:do_execsql_test(
         SELECT *, '|' FROM t1 LEFT JOIN t2 WHERE a=234 AND x=555;
     ]], {
         -- <autoindex4-1.4>
-        
+
         -- </autoindex4-1.4>
     })
 
@@ -97,7 +97,7 @@ test:do_execsql_test(
 -- Ticket [2326c258d02ead33d]
 -- Two joins, one with and the other without an ORDER BY clause.
 -- The one without ORDER BY correctly returns two rows of result.
--- The one with ORDER BY returns no rows. 
+-- The one with ORDER BY returns no rows.
 --
 test:do_execsql_test(
     "autoindex4-3.0",
diff --git a/test/sql-tap/colname.test.lua b/test/sql-tap/colname.test.lua
index dd93eed21..9ea0b2d4a 100755
--- a/test/sql-tap/colname.test.lua
+++ b/test/sql-tap/colname.test.lua
@@ -64,7 +64,7 @@ test:do_test(
             INSERT INTO txyz VALUES(4,5,6);
             CREATE TABLE tboth(a INT PRIMARY KEY,b INT,c INT,x INT,y INT,z INT);
             INSERT INTO tboth VALUES(11,12,13,14,15,16);
-            CREATE VIEW v1 AS SELECT tabC.a, txyZ.x, * 
+            CREATE VIEW v1 AS SELECT tabC.a, txyZ.x, *
               FROM tabc, txyz ORDER BY 1 LIMIT 1;
             CREATE VIEW v2 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
               FROM tabc, txyz, tboth ORDER BY 1 LIMIT 1;
@@ -166,7 +166,7 @@ test:do_test(
             UPDATE "_session_settings" SET "value" = false WHERE "name" = 'sql_full_column_names';
             CREATE VIEW v3 AS SELECT tabC.a, txyZ.x, *
               FROM tabc, txyz ORDER BY 1 LIMIT 1;
-            CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, * 
+            CREATE VIEW v4 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
               FROM tabc, txyz, tboth ORDER BY 1 LIMIT 1;
         ]]
         return test:execsql2 [[
@@ -286,7 +286,7 @@ test:do_test(
             UPDATE "_session_settings" SET "value" = true WHERE "name" = 'sql_full_column_names';
             CREATE VIEW v5 AS SELECT tabC.a, txyZ.x, *
               FROM tabc, txyz ORDER BY 1 LIMIT 1;
-            CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, * 
+            CREATE VIEW v6 AS SELECT tabC.a, txyZ.x, tboTh.a, tbotH.x, *
               FROM tabc, txyz, tboth ORDER BY 1 LIMIT 1;
         ]]
         return test:execsql2 [[
diff --git a/test/sql-tap/contrib01.test.lua b/test/sql-tap/contrib01.test.lua
index 74c5af54c..cc50d027c 100755
--- a/test/sql-tap/contrib01.test.lua
+++ b/test/sql-tap/contrib01.test.lua
@@ -18,7 +18,7 @@ test:plan(3)
 -- This file contains test cases that were contributed on the sql-users
 -- mailing list on 2013-06-05 by Mi Chen at mi.chen at echostar.com.
 --
--- At the time it was contributed, this test failed on trunk, but 
+-- At the time it was contributed, this test failed on trunk, but
 -- worked on the NGQP.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -72,7 +72,7 @@ test:do_test(
         ]]
     end, {
         -- <contrib01-1.0>
-        
+
         -- </contrib01-1.0>
     })
 
diff --git a/test/sql-tap/date.test.lua b/test/sql-tap/date.test.lua
index 0b37d52f8..ffa229959 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -234,13 +234,13 @@ datetest(5.15, "datetime('1994-04-16 14:00:00 +05:00 Z')", "NULL")
 -- and in New York.)
 --
 -- On non-Vista Windows platform, '2006-03-31' is treated incorrectly as being
--- in DST giving a 4 hour offset instead of 5.  In 2007, DST was extended to 
+-- in DST giving a 4 hour offset instead of 5.  In 2007, DST was extended to
 -- start three weeks earlier (second Sunday in March) and end one week
 -- later (first Sunday in November).  Older Windows systems apply this
 -- new rule incorrectly to dates prior to 2007.
 --
 -- It might be argued that this is masking a problem on non-Vista Windows
--- platform.  A ticket has already been opened for this issue 
+-- platform.  A ticket has already been opened for this issue
 -- (http://www.sql.org/cvstrac/tktview?tn=2322).  This is just to prevent
 -- more confusion/reports of the issue.
 --
diff --git a/test/sql-tap/default.test.lua b/test/sql-tap/default.test.lua
index 1832e3af7..9c15220eb 100755
--- a/test/sql-tap/default.test.lua
+++ b/test/sql-tap/default.test.lua
@@ -26,7 +26,7 @@ test:do_execsql_test(
 	"default-1.1",
 	[[
 		CREATE TABLE t1(
-		rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+		rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 		a INTEGER,
 		b SCALAR DEFAULT x'6869'
 		);
@@ -44,7 +44,7 @@ test:do_execsql_test(
 	"default-1.2",
 	[[
 	CREATE TABLE t2(
-	rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+	rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 	x INTEGER,
 	y INTEGER DEFAULT NULL
 	);
@@ -60,7 +60,7 @@ test:do_catchsql_test(
 	"default-1.3",
 	[[
 	CREATE TABLE t3(
-	rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+	rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 	x INTEGER,
 	y INTEGER DEFAULT (max(x,5))
 	);
@@ -74,7 +74,7 @@ test:do_execsql_test(
 	"default-2.1",
 	[[
 	CREATE TABLE t4(
-	rowid INTEGER PRIMARY KEY AUTOINCREMENT, 
+	rowid INTEGER PRIMARY KEY AUTOINCREMENT,
 	c TEXT DEFAULT 'abc'
 	);
 	PRAGMA table_info(t4);
@@ -110,7 +110,7 @@ test:do_execsql_test(
 	g INTEGER DEFAULT( 3600*12 )
 	);
 	INSERT INTO t3 VALUES(null, 5, 'row1', 5.25, 8.67, '321', 432);
-	SELECT a, typeof(a), b, typeof(b), c, typeof(c), 
+	SELECT a, typeof(a), b, typeof(b), c, typeof(c),
 	d, typeof(d), e, typeof(e), f, typeof(f),
 	g, typeof(g) FROM t3;
 	]], {
@@ -152,7 +152,7 @@ test:do_execsql_test(
 	-- </default-3.3>
 })
 
--- Do now allow bound parameters in new DEFAULT values. 
+-- Do now allow bound parameters in new DEFAULT values.
 -- Silently convert bound parameters to NULL in DEFAULT causes
 -- in the sql_master table, for backwards compatibility.
 --
diff --git a/test/sql-tap/delete3.test.lua b/test/sql-tap/delete3.test.lua
index e9d1f5a21..eb20ebd52 100755
--- a/test/sql-tap/delete3.test.lua
+++ b/test/sql-tap/delete3.test.lua
@@ -47,7 +47,7 @@ test:do_execsql_test(
         INSERT INTO t1 SELECT x+131072 FROM t1;
         INSERT INTO t1 SELECT x+262144 FROM t1;
         COMMIT;
-        SELECT count(*) FROM t1;	
+        SELECT count(*) FROM t1;
     ]], {
         -- <delete3-1.1>
         524288
diff --git a/test/sql-tap/delete4.test.lua b/test/sql-tap/delete4.test.lua
index 14bdac151..7fa64e08e 100755
--- a/test/sql-tap/delete4.test.lua
+++ b/test/sql-tap/delete4.test.lua
@@ -123,7 +123,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(8, 'four', 'iv');
     ]], {
         -- <3.1>
-        
+
         -- </3.1>
     })
 
@@ -143,8 +143,8 @@ test:do_execsql_test(
         -- </3.3>
     })
 
--- do_execsql_test 3.4 { 
---   PRAGMA integrity_check; 
+-- do_execsql_test 3.4 {
+--   PRAGMA integrity_check;
 -- } {ok}
 -- Between 2015-09-14 and 2015-09-28, the following test cases would result
 -- in corruption (wrong # of entries in index) due to a bug in the ONEPASS
@@ -160,7 +160,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.1>
-        
+
         -- </4.1>
     })
 
@@ -174,7 +174,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.2>
-        
+
         -- </4.2>
     })
 
@@ -189,7 +189,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.11>
-        
+
         -- </4.11>
     })
 
@@ -204,7 +204,7 @@ test:do_execsql_test(
         DELETE FROM t4 WHERE col0=69 OR col0>7;
     ]], {
         -- <4.12>
-        
+
         -- </4.12>
     })
 
diff --git a/test/sql-tap/distinct.test.lua b/test/sql-tap/distinct.test.lua
index 3b5bf550c..fefc8ff52 100755
--- a/test/sql-tap/distinct.test.lua
+++ b/test/sql-tap/distinct.test.lua
@@ -83,8 +83,8 @@ local function do_temptables_test(tn, sql, temptables)
 end
 
 ---------------------------------------------------------------------------
--- The following tests - distinct-1.* - check that the planner correctly 
--- detects cases where a UNIQUE index means that a DISTINCT clause is 
+-- The following tests - distinct-1.* - check that the planner correctly
+-- detects cases where a UNIQUE index means that a DISTINCT clause is
 -- redundant. Currently the planner only detects such cases when there
 -- is a single table in the FROM clause.
 --
@@ -147,7 +147,7 @@ for _, val in ipairs(data) do
 end
 ---------------------------------------------------------------------------
 -- The following tests - distinct-2.* - test cases where an index is
--- used to deliver results in order of the DISTINCT expressions. 
+-- used to deliver results in order of the DISTINCT expressions.
 --
 --X(143, "X!cmd", [=[["drop_all_tables"]]=])
 test:execsql([[
diff --git a/test/sql-tap/e_delete.test.lua b/test/sql-tap/e_delete.test.lua
index d1cf2a79f..71e605513 100755
--- a/test/sql-tap/e_delete.test.lua
+++ b/test/sql-tap/e_delete.test.lua
@@ -14,7 +14,7 @@ test:plan(18)
 --
 -------------------------------------------------------------------------
 --
--- This file implements tests to verify that the "testable statements" in 
+-- This file implements tests to verify that the "testable statements" in
 -- the lang_delete.html document are correct.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 1260b321c..a748001ce 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -3143,14 +3143,14 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(4, NULL, NULL);
     ]], {
         -- <e_expr-34.1>
-        
+
         -- </e_expr-34.1>
     })
 
 -- EVIDENCE-OF: R-25588-27181 The EXISTS operator always evaluates to one
 -- of the integer values 0 and 1.
 --
--- This statement is not tested by itself. Instead, all e_expr-34.* tests 
+-- This statement is not tested by itself. Instead, all e_expr-34.* tests
 -- following this point explicitly test that specific invocations of EXISTS
 -- return either integer 0 or integer 1.
 --
@@ -3233,7 +3233,7 @@ test:do_execsql_test(
         INSERT INTO t22 VALUES('three', NULL);
     ]], {
         -- <e_expr-35.0>
-        
+
         -- </e_expr-35.0>
     })
 
@@ -3248,10 +3248,10 @@ do_expr_test("e_expr-35.1.1", " (SELECT 35)   ", "integer", 35)
 do_expr_test("e_expr-35.1.2", " (SELECT NULL) ", "null", "")
 do_expr_test("e_expr-35.1.3", " (SELECT count(*) FROM t22) ", "integer", 2)
 do_expr_test("e_expr-35.1.4", " (SELECT 4 FROM t22 LIMIT 1) ", "integer", 4)
-do_expr_test("e_expr-35.1.5", [[ 
+do_expr_test("e_expr-35.1.5", [[
   (SELECT b FROM t22 UNION SELECT a+1 FROM t22 LIMIT 1)
 ]], "null", "")
-do_expr_test("e_expr-35.1.6", [[ 
+do_expr_test("e_expr-35.1.6", [[
   (SELECT a FROM t22 UNION SELECT COALESCE(b, 55) FROM t22 ORDER BY 1 LIMIT 1)
 ]], "integer", 55)
 -- EVIDENCE-OF: R-46899-53765 A SELECT used as a scalar quantity must
@@ -3292,7 +3292,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES(3, 'three');
     ]], {
         -- <e_expr-36.3.1>
-        
+
         -- </e_expr-36.3.1>
     })
 
diff --git a/test/sql-tap/e_select1.test.lua b/test/sql-tap/e_select1.test.lua
index 66eaa5339..35eb162e8 100755
--- a/test/sql-tap/e_select1.test.lua
+++ b/test/sql-tap/e_select1.test.lua
@@ -14,7 +14,7 @@ test:plan(509)
 --
 -------------------------------------------------------------------------
 --
--- This file implements tests to verify that the "testable statements" in 
+-- This file implements tests to verify that the "testable statements" in
 -- the lang_select.html document are correct.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -43,7 +43,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES('b', 2);
     ]], {
         -- <e_select-1.0>
-        
+
         -- </e_select-1.0>
     })
 
diff --git a/test/sql-tap/eqp.test.lua b/test/sql-tap/eqp.test.lua
index bc46a920e..811ef046f 100755
--- a/test/sql-tap/eqp.test.lua
+++ b/test/sql-tap/eqp.test.lua
@@ -101,7 +101,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T3 (~1048576 rows)"},
         {0, 0, 0, "USE TEMP B-TREE FOR GROUP BY"},
         {0, 0, 0, "USE TEMP B-TREE FOR DISTINCT"},
-        
+
         -- </1.6>
     })
 
@@ -113,7 +113,7 @@ test:do_eqp_test(
         -- <1.7>
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.7>
     })
 
@@ -126,7 +126,7 @@ test:do_eqp_test(
         {1, 0, 0, "COMPOUND SUBQUERIES 2 AND 3 USING TEMP B-TREE (UNION)"},
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.8>
     })
 
@@ -154,7 +154,7 @@ test:do_eqp_test(
         {1, 0, 0, "COMPOUND SUBQUERIES 2 AND 3 USING TEMP B-TREE (INTERSECT)"},
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.10>
     })
 
@@ -168,7 +168,7 @@ test:do_eqp_test(
         {1, 0, 0, "COMPOUND SUBQUERIES 2 AND 3 (UNION ALL)"},
         {0, 0, 1, "SCAN SUBQUERY 1 (~1 row)"},
         {0, 1, 0, "SCAN TABLE T3 (~1048576 rows)"},
-        
+
         -- </1.11>
     })
 
@@ -243,7 +243,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T1 AS SUB (~1048576 rows)"},
-        
+
         -- </3.1.1>
     })
 
@@ -256,7 +256,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T1 AS SUB (~1048576 rows)"},
-        
+
         -- </3.1.2>
     })
 
@@ -270,7 +270,7 @@ test:do_eqp_test(
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T1 AS SUB (~1048576 rows)"},
         {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
-        
+
         -- </3.1.3>
     })
 
@@ -283,7 +283,7 @@ test:do_eqp_test(
         {0, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {0, 0, 0, "EXECUTE SCALAR SUBQUERY 1"},
         {1, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
-        
+
         -- </3.1.4>
     })
 
@@ -291,18 +291,18 @@ test:do_eqp_test("3.2.1", [[
   SELECT * FROM (SELECT * FROM t1 ORDER BY x LIMIT 10) ORDER BY y LIMIT 5
 ]], {
     {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
-    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"}, 
+    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
     {0, 0, 0, "SCAN SUBQUERY 1 (~1 row)"},
     {0, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
 })
 test:do_eqp_test("3.2.2", [[
-  SELECT * FROM 
+  SELECT * FROM
     (SELECT * FROM t1 ORDER BY x LIMIT 10) AS x1,
     (SELECT * FROM t2 ORDER BY x LIMIT 10) AS x2
   ORDER BY x2.y LIMIT 5
 ]], {
     {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
-    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"}, 
+    {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
     {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
     {0, 0, 0, "SCAN SUBQUERY 1 AS X1 (~1 row)"},
     {0, 1, 1, "SCAN SUBQUERY 2 AS X2 (~1 row)"},
@@ -312,21 +312,21 @@ test:do_eqp_test("3.3.1", [[
   SELECT * FROM t1 WHERE y IN (SELECT y FROM t2)
 ]], {
     {0, 0, 0, "SCAN TABLE T1 (~983040 rows)"},
-    {0, 0, 0, "EXECUTE LIST SUBQUERY 1"}, 
+    {0, 0, 0, "EXECUTE LIST SUBQUERY 1"},
     {1, 0, 0, "SCAN TABLE T2 (~1048576 rows)"},
 })
 test:do_eqp_test("3.3.2", [[
   SELECT * FROM t1 WHERE y IN (SELECT y FROM t2 WHERE t1.x!=t2.x)
 ]], {
     {0, 0, 0, "SCAN TABLE T1 (~983040 rows)"},
-    {0, 0, 0, "EXECUTE CORRELATED LIST SUBQUERY 1"}, 
+    {0, 0, 0, "EXECUTE CORRELATED LIST SUBQUERY 1"},
     {1, 0, 0, "SCAN TABLE T2 (~983040 rows)"},
 })
 test:do_eqp_test("3.3.3", [[
   SELECT * FROM t1 WHERE EXISTS (SELECT y FROM t2 WHERE t1.x!=t2.x)
 ]], {
     {0, 0, 0, "SCAN TABLE T1 (~983040 rows)"},
-    {0, 0, 0, "EXECUTE CORRELATED SCALAR SUBQUERY 1"}, 
+    {0, 0, 0, "EXECUTE CORRELATED SCALAR SUBQUERY 1"},
     {1, 0, 0, "SCAN TABLE T2 (~983040 rows)"},
 })
 ---------------------------------------------------------------------------
@@ -341,7 +341,7 @@ test:do_eqp_test(
         {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {2, 0, 0, "SCAN TABLE T2 (~1048576 rows)"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (UNION ALL)"},
-        
+
         -- </4.1.1>
     })
 
@@ -355,7 +355,7 @@ test:do_eqp_test(
         {1, 0, 0, "USE TEMP B-TREE FOR ORDER BY"},
         {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (UNION ALL)"},
-        
+
         -- </4.1.2>
     })
 
@@ -370,7 +370,7 @@ test:do_eqp_test(
         {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
         {2, 0, 0, "USE TEMP B-TREE FOR RIGHT PART OF ORDER BY"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (UNION)"},
-        
+
         -- </4.1.3>
     })
 
@@ -385,7 +385,7 @@ test:do_eqp_test(
         {2, 0, 0, "SCAN TABLE T2 USING COVERING INDEX T2I1 (~1048576 rows)"},
         {2, 0, 0, "USE TEMP B-TREE FOR RIGHT PART OF ORDER BY"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (INTERSECT)"},
-        
+
         -- </4.1.4>
     })
 
@@ -471,7 +471,7 @@ test:do_eqp_test(
         {1, 0, 0, "SCAN TABLE T1 (~1048576 rows)"},
         {2, 0, 0, "SCAN TABLE T2 (~1048576 rows)"},
         {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 USING TEMP B-TREE (UNION)"},
-        
+
         -- </4.3.1>
     })
 
@@ -506,7 +506,7 @@ test:do_eqp_test(
     })
 
 ---------------------------------------------------------------------------
--- This next block of tests verifies that the examples on the 
+-- This next block of tests verifies that the examples on the
 -- lang_explain.html page are correct.
 --
 test:drop_all_tables()
@@ -530,7 +530,7 @@ test:do_eqp_test("5.1.1", "SELECT a, b FROM t1 WHERE a=1", {
 test:do_execsql_test(
     "5.2.0",
     [[
-        CREATE INDEX i1 ON t1(a) 
+        CREATE INDEX i1 ON t1(a)
     ]])
 
 test:do_eqp_test("5.2.1", "SELECT a, b FROM t1 WHERE a=1", {
@@ -543,7 +543,7 @@ test:do_eqp_test("5.2.1", "SELECT a, b FROM t1 WHERE a=1", {
 test:do_execsql_test(
     "5.3.0",
     [[
-        CREATE INDEX i2 ON t1(a, b) 
+        CREATE INDEX i2 ON t1(a, b)
     ]])
 
 test:do_eqp_test("5.3.1", "SELECT a, b FROM t1 WHERE a=1", {
@@ -682,9 +682,9 @@ test:do_eqp_test("5.13", "SELECT a FROM t1 EXCEPT SELECT d FROM t2 ORDER BY 1",
     {0, 0, 0, "COMPOUND SUBQUERIES 1 AND 2 (EXCEPT)"},
 })
 -- #-------------------------------------------------------------------------
--- # The following tests - eqp-6.* - test that the example C code on 
+-- # The following tests - eqp-6.* - test that the example C code on
 -- # documentation page eqp.html works. The C code is duplicated in test1.c
--- # and wrapped in Tcl command [print_explain_query_plan] 
+-- # and wrapped in Tcl command [print_explain_query_plan]
 -- #
 -- set boilerplate {
 --   proc explain_query_plan {db sql} {
diff --git a/test/sql-tap/func5.test.lua b/test/sql-tap/func5.test.lua
index b1e246ccc..9b1526aaf 100755
--- a/test/sql-tap/func5.test.lua
+++ b/test/sql-tap/func5.test.lua
@@ -53,7 +53,7 @@ test:do_execsql_test(
 -- and it really is non-deterministic, returning a different result each
 -- time.  But counter2() is marked as deterministic, so it does get factored
 -- out of the loop.  counter2() has the same implementation as counter1(),
--- returning a different result on each invocation, but because it is 
+-- returning a different result on each invocation, but because it is
 -- only invoked once outside of the loop, it appears to return the same
 -- result multiple times.
 --
diff --git a/test/sql-tap/icu.test.lua b/test/sql-tap/icu.test.lua
index 4e25ba7c5..f02b8a8b0 100755
--- a/test/sql-tap/icu.test.lua
+++ b/test/sql-tap/icu.test.lua
@@ -96,7 +96,7 @@ if (0 > 0)
             INSERT INTO fruit VALUES('yamot');
         ]], {
             -- <icu-4.1>
-            
+
             -- </icu-4.1>
         })
 
@@ -130,7 +130,7 @@ if (0 > 0)
         })
 
     ---------------------------------------------------------------------------
-    -- Test that it is not possible to call the ICU regex() function with 
+    -- Test that it is not possible to call the ICU regex() function with
     -- anything other than exactly two arguments. See also:
     --
     --   http://src.chromium.org/viewvc/chrome/trunk/src/third_party/sql/icu-regexp.patch?revision=34807&view=markup
@@ -146,7 +146,7 @@ if (0 > 0)
     test:do_catchsql_test(
         "icu-5.2",
         [=[
-            SELECT regexp('a[abc]c.*') 
+            SELECT regexp('a[abc]c.*')
         ]=], {
             -- <icu-5.2>
             1, "wrong number of arguments to function REGEXP()"
@@ -156,7 +156,7 @@ if (0 > 0)
     test:do_catchsql_test(
         "icu-5.3",
         [=[
-            SELECT regexp('a[abc]c.*', 'abc', 'c') 
+            SELECT regexp('a[abc]c.*', 'abc', 'c')
         ]=], {
             -- <icu-5.3>
             1, "wrong number of arguments to function REGEXP()"
diff --git a/test/sql-tap/in1.test.lua b/test/sql-tap/in1.test.lua
index e889844dc..4b51da6e8 100755
--- a/test/sql-tap/in1.test.lua
+++ b/test/sql-tap/in1.test.lua
@@ -200,7 +200,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE b IN (GREATEST(5,10),20)
     ]], {
         -- <in-2.9>
-        
+
         -- </in-2.9>
     })
 
@@ -210,7 +210,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE LEAST(0, CAST(b IN (a,30) AS INT)) <> 0
     ]], {
         -- <in-2.10>
-        
+
         -- </in-2.10>
     })
 
@@ -266,7 +266,7 @@ test:do_test(
     "in-4.1",
     function()
         test:execsql [[
-            UPDATE t1 SET b=b*2 
+            UPDATE t1 SET b=b*2
             WHERE b IN (SELECT b FROM t1 WHERE a>8)
         ]]
         return test:execsql "SELECT b FROM t1 ORDER BY b"
@@ -448,7 +448,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE a IN ();
     ]], {
         -- <in-7.1>
-        
+
         -- </in-7.1>
     })
 
@@ -478,7 +478,7 @@ test:do_execsql_test(
         SELECT a FROM t1 WHERE a IN (5) AND b IN ();
     ]], {
         -- <in-7.4>
-        
+
         -- </in-7.4>
     })
 
@@ -498,7 +498,7 @@ test:do_execsql_test(
         SELECT a FROM ta WHERE a IN ();
     ]], {
         -- <in-7.6.1>
-        
+
         -- </in-7.6.1>
     })
 
@@ -529,7 +529,7 @@ test:do_execsql_test(
         SELECT * FROM ta LEFT JOIN tb ON (ta.b=tb.b) WHERE ta.a IN ();
     ]], {
         -- <in-7.8.1>
-        
+
         -- </in-7.8.1>
     })
 
@@ -561,7 +561,7 @@ test:do_execsql_test(
     [[
         CREATE TABLE t4 (a INTEGER PRIMARY KEY);
         INSERT INTO t4 SELECT a FROM tb;
-        SELECT * FROM t4;    
+        SELECT * FROM t4;
     ]], {
         -- <in-9.1>
         1, 2, 3, 5, 7, 9, 11
@@ -665,7 +665,7 @@ test:do_execsql_test(
         CREATE TABLE t3(a  INT PRIMARY KEY, b INT , c INT );
     ]], {
         -- <in-12.1>
-        
+
         -- </in-12.1>
     })
 
@@ -843,12 +843,12 @@ test:do_catchsql_test(
 
 --ifcapable compound
 --------------------------------------------------------------------------
--- The following tests check that NULL is handled correctly when it 
+-- The following tests check that NULL is handled correctly when it
 -- appears as part of a set of values on the right-hand side of an
 -- IN or NOT IN operator.
 --
 -- When it appears in such a set, NULL is handled as an "unknown value".
--- If, because of the unknown value in the set, the result of the expression 
+-- If, because of the unknown value in the set, the result of the expression
 -- cannot be determined, then it itself evaluates to NULL.
 --
 -- Warm body test to demonstrate the principles being tested:
@@ -857,7 +857,7 @@ test:do_test(
     "in-13.1",
     function()
         --  db("nullvalue", '')
-        return test:execsql [[ SELECT 
+        return test:execsql [[ SELECT
     1 IN (NULL, 1, 2),     -- The value 1 is a member of the set, return true.
     3 IN (NULL, 1, 2),     -- Ambiguous, return NULL.
     1 NOT IN (NULL, 1, 2), -- The value 1 is a member of the set, return false.
@@ -880,14 +880,14 @@ test:do_execsql_test(
         INSERT INTO t7 VALUES(5, NULL, 5, 5);
     ]], {
         -- <in-13.2>
-        
+
         -- </in-13.2>
     })
 
 test:do_execsql_test(
     "in-13.3",
     [[
-        SELECT 2 IN (SELECT a FROM t7) 
+        SELECT 2 IN (SELECT a FROM t7)
     ]], {
         -- <in-13.3>
         true
@@ -897,7 +897,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.4",
     [[
-        SELECT 6 IN (SELECT a FROM t7) 
+        SELECT 6 IN (SELECT a FROM t7)
     ]], {
         -- <in-13.4>
         ""
@@ -907,7 +907,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.5",
     [[
-        SELECT 2 IN (SELECT b FROM t7) 
+        SELECT 2 IN (SELECT b FROM t7)
     ]], {
         -- <in-13.5>
         true
@@ -917,7 +917,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.6",
     [[
-        SELECT 6 IN (SELECT b FROM t7) 
+        SELECT 6 IN (SELECT b FROM t7)
     ]], {
         -- <in-13.6>
         false
@@ -927,7 +927,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.7",
     [[
-        SELECT 2 IN (SELECT c FROM t7) 
+        SELECT 2 IN (SELECT c FROM t7)
     ]], {
         -- <in-13.7>
         true
@@ -937,7 +937,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in-13.8",
     [[
-        SELECT 6 IN (SELECT c FROM t7) 
+        SELECT 6 IN (SELECT c FROM t7)
     ]], {
         -- <in-13.8>
         false
@@ -964,8 +964,8 @@ test:do_execsql_test(
     "in-13.10",
     [[
         SELECT b IN (
-          SELECT inside.a 
-          FROM t7 AS inside 
+          SELECT inside.a
+          FROM t7 AS inside
           WHERE inside.b BETWEEN outside.b+1 AND outside.b+2
         )
         FROM t7 AS outside ORDER BY b;
@@ -979,8 +979,8 @@ test:do_execsql_test(
     "in-13.11",
     [[
         SELECT b NOT IN (
-          SELECT inside.a 
-          FROM t7 AS inside 
+          SELECT inside.a
+          FROM t7 AS inside
           WHERE inside.b BETWEEN outside.b+1 AND outside.b+2
         )
         FROM t7 AS outside ORDER BY b;
@@ -1069,7 +1069,7 @@ test:do_catchsql_test(
 --         return db("nullvalue", "")
 --     end, {
 --         -- <in-13.X>
-        
+
 --         -- </in-13.X>
 --     })
 
diff --git a/test/sql-tap/in2.test.lua b/test/sql-tap/in2.test.lua
index dcdf4b0ed..9cddd2249 100755
--- a/test/sql-tap/in2.test.lua
+++ b/test/sql-tap/in2.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
         CREATE TABLE a(i INTEGER PRIMARY KEY, a INT);
     ]], {
         -- <in2-1>
-        
+
         -- </in2-1>
     })
 
@@ -62,7 +62,7 @@ test:do_test(
   -- ]=])
     end, {
         -- <in2-2>
-        
+
         -- </in2-2>
     })
 
@@ -77,11 +77,11 @@ test:do_test(
 -- Records are inserted in sorted order.
 --
 -- The string of zero-length is stored in a b-tree cell with 3 bytes
--- of payload. Moving this cell from a leaf node to a internal node 
--- during b-tree balancing was causing an assertion failure. 
+-- of payload. Moving this cell from a leaf node to a internal node
+-- during b-tree balancing was causing an assertion failure.
 --
--- This bug only applied to b-trees generated to evaluate IN (..) 
--- clauses, as it is impossible for persistent b-trees (SQL tables + 
+-- This bug only applied to b-trees generated to evaluate IN (..)
+-- clauses, as it is impossible for persistent b-trees (SQL tables +
 -- indices) to contain cells smaller than 4 bytes.
 --
 for ii=3,N-1 do
diff --git a/test/sql-tap/in3.test.lua b/test/sql-tap/in3.test.lua
index 1dcf7c8e3..5f3f543af 100755
--- a/test/sql-tap/in3.test.lua
+++ b/test/sql-tap/in3.test.lua
@@ -13,7 +13,7 @@ test:plan(28)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- This file tests the optimisations made in November 2007 of expressions 
+-- This file tests the optimisations made in November 2007 of expressions
 -- of the following form:
 --
 --     <value> IN (SELECT <column> FROM <table>)
@@ -64,7 +64,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(5, 6);
     ]], {
         -- <in3-1.1>
-        
+
         -- </in3-1.1>
     })
 
@@ -97,7 +97,7 @@ test:do_test(
     })
 
 -- Because none of the sub-select queries in the following statements
--- match the pattern ("SELECT <column> FROM <table>"), the following do 
+-- match the pattern ("SELECT <column> FROM <table>"), the following do
 -- require a temp table.
 --
 -- do_test in3-1.6 {
@@ -146,7 +146,7 @@ test:do_test(
         -- </in3-1.10>
     })
 
--- These do use the temp-table. Adding the LIMIT clause means the 
+-- These do use the temp-table. Adding the LIMIT clause means the
 -- ORDER BY cannot be ignored.
 test:do_test(
     "in3-1.11",
@@ -198,7 +198,7 @@ test:do_execsql_test(
         -- </in3-1.14>
     })
 
--- The first of these queries has to use the temp-table, because the 
+-- The first of these queries has to use the temp-table, because the
 -- collation sequence used for the index on "t1.a" does not match the
 -- collation sequence used by the "IN" comparison. The second does not
 -- require a temp-table, because the collation sequences match.
@@ -261,8 +261,8 @@ test:do_execsql_test(
 -- } {}
 -- do_test in3-2.2 {
 --   execsql {
---     SELECT rowid 
---     FROM t1 
+--     SELECT rowid
+--     FROM t1
 --     WHERE rowid IN (SELECT rowid FROM t1 WHERE rowid IN (1, 2));
 --   }
 -- } {1 2}
@@ -273,7 +273,7 @@ test:do_execsql_test(
 -- } {2 4}
 -- do_test in3-2.4 {
 --   execsql {
---     SELECT rowid FROM t1 WHERE rowid IN 
+--     SELECT rowid FROM t1 WHERE rowid IN
 --        (select rowid from t1 where rowid IN (-1,2,4))
 --   }
 -- } {2 4}
@@ -305,7 +305,7 @@ test:do_test(
         ]]
     end, {
         -- <in3-3.1>
-        
+
         -- </in3-3.1>
     })
 
@@ -349,7 +349,7 @@ test:do_test(
 test:do_test(
     "in3-3.6",
     function()
-        -- Numeric affinity is applied to both sides before 
+        -- Numeric affinity is applied to both sides before
         -- the comparison.  Therefore it is possible to use index t1_i2.
         return exec_neph(" SELECT y IN (SELECT b FROM t1) FROM t2 ")
     end, {
@@ -361,7 +361,7 @@ test:do_test(
 test:do_test(
     "in3-3.7",
     function()
-        -- Numeric affinity is applied before the comparison takes place. 
+        -- Numeric affinity is applied before the comparison takes place.
         -- Making it impossible to use index t1_i3.
         return exec_neph(" SELECT y IN (SELECT c FROM t1) FROM t2 ")
     end, {
@@ -389,7 +389,7 @@ test:do_test(
         ]]
     end, {
         -- <in3-4.1>
-        
+
         -- </in3-4.1>
     })
 
@@ -447,7 +447,7 @@ test:do_execsql_test(
         DROP INDEX t3_i2 ON t3
     ]], {
         -- <in3-4.6>
-        
+
         -- </in3-4.6>
     })
 
@@ -457,14 +457,14 @@ test:do_execsql_test(
     "in3-5.1",
     [[
         CREATE TABLE Folders(
-          folderid INTEGER PRIMARY KEY, 
-          parentid INTEGER, 
-          rootid INTEGER, 
+          folderid INTEGER PRIMARY KEY,
+          parentid INTEGER,
+          rootid INTEGER,
           path VARCHAR(255)
         );
     ]], {
         -- <in3-5.1>
-        
+
         -- </in3-5.1>
     })
 
diff --git a/test/sql-tap/in4.test.lua b/test/sql-tap/in4.test.lua
index 7374f926e..8442944b9 100755
--- a/test/sql-tap/in4.test.lua
+++ b/test/sql-tap/in4.test.lua
@@ -24,7 +24,7 @@ test:do_execsql_test(
         CREATE INDEX i1 ON t1(a);
     ]], {
         -- <in4-1.1>
-        
+
         -- </in4-1.1>
     })
 
@@ -34,7 +34,7 @@ test:do_execsql_test(
         SELECT * FROM t1 WHERE a IN ('aaa', 'bbb', 'ccc');
     ]], {
         -- <in4-1.2>
-        
+
         -- </in4-1.2>
     })
 
@@ -83,14 +83,14 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(3, 'three');
     ]], {
         -- <in4-2.1>
-        
+
         -- </in4-2.1>
     })
 
 test:do_execsql_test(
     "in4-2.2",
     [[
-        SELECT b FROM t2 WHERE a IN (0, 2) 
+        SELECT b FROM t2 WHERE a IN (0, 2)
     ]], {
         -- <in4-2.2>
         "zero", "two"
@@ -100,7 +100,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.3",
     [[
-        SELECT b FROM t2 WHERE a IN (2, 0) 
+        SELECT b FROM t2 WHERE a IN (2, 0)
     ]], {
         -- <in4-2.3>
         "zero", "two"
@@ -110,7 +110,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.4",
     [[
-        SELECT b FROM t2 WHERE a IN (2, -1) 
+        SELECT b FROM t2 WHERE a IN (2, -1)
     ]], {
         -- <in4-2.4>
         "-one", "two"
@@ -120,7 +120,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.5",
     [[
-        SELECT b FROM t2 WHERE a IN (NULL, 3) 
+        SELECT b FROM t2 WHERE a IN (NULL, 3)
     ]], {
         -- <in4-2.5>
         "three"
@@ -130,7 +130,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.6",
     [[
-        SELECT b FROM t2 WHERE a IN (1.0, 2.1) 
+        SELECT b FROM t2 WHERE a IN (1.0, 2.1)
     ]], {
         -- <in4-2.6>
         "one"
@@ -150,7 +150,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-2.8",
     [[
-        SELECT b FROM t2 WHERE a IN ('', '0.0.0', '2') 
+        SELECT b FROM t2 WHERE a IN ('', '0.0.0', '2')
     ]], {
         -- <in4-2.8>
         "two"
@@ -161,9 +161,9 @@ test:do_execsql_test(
 --
 --    <expr> IN ()
 --
--- i.e. IN expressions with a literal empty set. 
--- 
--- This has led to crashes on more than one occasion. Test case in4-3.2 
+-- i.e. IN expressions with a literal empty set.
+--
+-- This has led to crashes on more than one occasion. Test case in4-3.2
 -- was added in reponse to a bug reported on the mailing list on 11/7/2008.
 -- See also tickets #3602 and #185.
 --
@@ -186,7 +186,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(4, NULL, NULL);
     ]], {
         -- <in4-3.1>
-        
+
         -- </in4-3.1>
     })
 
@@ -196,7 +196,7 @@ test:do_execsql_test(
         SELECT x FROM t1 WHERE id IN () AND x IN (SELECT x FROM t2 WHERE id=1)
     ]], {
         -- <in4-3.2>
-        
+
         -- </in4-3.2>
     })
 
@@ -212,34 +212,34 @@ test:do_test(
         return test:execsql " SELECT * FROM t3 WHERE x IN () "
     end, {
         -- <in4-3.3>
-        
+
         -- </in4-3.3>
     })
 
 test:do_execsql_test(
     "in4-3.4",
     [[
-        SELECT * FROM t3 WHERE x = 10 AND y IN () 
+        SELECT * FROM t3 WHERE x = 10 AND y IN ()
     ]], {
         -- <in4-3.4>
-        
+
         -- </in4-3.4>
     })
 
 test:do_execsql_test(
     "in4-3.5",
     [[
-        SELECT * FROM t3 WHERE x IN () AND y = 10 
+        SELECT * FROM t3 WHERE x IN () AND y = 10
     ]], {
         -- <in4-3.5>
-        
+
         -- </in4-3.5>
     })
 
 test:do_execsql_test(
     "in4-3.6",
     [[
-        SELECT * FROM t3 WHERE x IN () OR x = 10 
+        SELECT * FROM t3 WHERE x IN () OR x = 10
     ]], {
         -- <in4-3.6>
         10, 10, 10
@@ -249,27 +249,27 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-3.7",
     [[
-        SELECT * FROM t3 WHERE y IN () 
+        SELECT * FROM t3 WHERE y IN ()
     ]], {
         -- <in4-3.7>
-        
+
         -- </in4-3.7>
     })
 
 test:do_execsql_test(
     "in4-3.8",
     [[
-        SELECT x IN() AS a FROM t3 WHERE a 
+        SELECT x IN() AS a FROM t3 WHERE a
     ]], {
         -- <in4-3.8>
-        
+
         -- </in4-3.8>
     })
 
 test:do_execsql_test(
     "in4-3.9",
     [[
-        SELECT x IN() AS a FROM t3 WHERE NOT a 
+        SELECT x IN() AS a FROM t3 WHERE NOT a
     ]], {
         -- <in4-3.9>
         false, false
@@ -279,10 +279,10 @@ test:do_execsql_test(
 test:do_execsql_test(
     "in4-3.10",
     [[
-        SELECT * FROM t3 WHERE oid IN () 
+        SELECT * FROM t3 WHERE oid IN ()
     ]], {
         -- <in4-3.10>
-        
+
         -- </in4-3.10>
     })
 
@@ -302,7 +302,7 @@ test:do_execsql_test(
         SELECT * FROM t3 WHERE x IN (1, 2) AND y IN ()
     ]], {
         -- <in4-3.12>
-        
+
         -- </in4-3.12>
     })
 
diff --git a/test/sql-tap/index3.test.lua b/test/sql-tap/index3.test.lua
index 909a184da..4a27a3fdd 100755
--- a/test/sql-tap/index3.test.lua
+++ b/test/sql-tap/index3.test.lua
@@ -48,7 +48,7 @@ test:do_execsql_test(
 -- integrity_check index3-1.4
 -- Backwards compatibility test:
 --
--- Verify that CREATE INDEX statements that use strings instead of 
+-- Verify that CREATE INDEX statements that use strings instead of
 -- identifiers for the the column names continue to work correctly.
 -- This is undocumented behavior retained for backwards compatiblity.
 --
@@ -61,11 +61,11 @@ test:do_execsql_test(
         CREATE INDEX t1c ON t1(c);
         CREATE INDEX t1d ON t1(d);
         WITH RECURSIVE c(x) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<30)
-          INSERT INTO t1(a,b,c,d,e) 
+          INSERT INTO t1(a,b,c,d,e)
             SELECT x, printf('ab%03xxy',x), x, x, x FROM c;
     ]], {
         -- <index3-2.1>
-        
+
         -- </index3-2.1>
     })
 
diff --git a/test/sql-tap/index4.test.lua b/test/sql-tap/index4.test.lua
index cdc975e12..8fed92db1 100755
--- a/test/sql-tap/index4.test.lua
+++ b/test/sql-tap/index4.test.lua
@@ -50,7 +50,7 @@ test:do_execsql_test(
     ]])
 
 -- do_execsql_test 1.3 {
---   PRAGMA integrity_check 
+--   PRAGMA integrity_check
 -- } {ok}
 -- The same test again - this time with limited memory.
 --
@@ -91,11 +91,11 @@ test:do_execsql_test(
           INSERT INTO t1 SELECT randomblob(4202) FROM t1;     --   128
           INSERT INTO t1 SELECT randomblob(5202) FROM t1;     --   256
         COMMIT;
-        CREATE INDEX i1 ON t1(x); 
+        CREATE INDEX i1 ON t1(x);
         --PRAGMA integrity_check
     ]], {
         -- <1.6>
-        
+
         -- </1.6>
     })
 
@@ -107,11 +107,11 @@ test:do_execsql_test(
           CREATE TABLE t1(x TEXT primary key);
           INSERT INTO t1 VALUES('a');
         --COMMIT;
-        CREATE INDEX i1 ON t1(x); 
+        CREATE INDEX i1 ON t1(x);
         --PRAGMA integrity_check
     ]], {
         -- <1.7>
-        
+
         -- </1.7>
     })
 
@@ -125,11 +125,11 @@ if (1 > 0)
               DROP TABLE t1;
               CREATE TABLE t1(x INT primary key);
             --COMMIT;
-            CREATE INDEX i1 ON t1(x); 
+            CREATE INDEX i1 ON t1(x);
             --PRAGMA integrity_check
         ]], {
             -- <1.8>
-            
+
             -- </1.8>
         })
 
diff --git a/test/sql-tap/insert1.test.lua b/test/sql-tap/insert1.test.lua
index 094fae0e9..25258cfb4 100755
--- a/test/sql-tap/insert1.test.lua
+++ b/test/sql-tap/insert1.test.lua
@@ -141,7 +141,7 @@ end, {
 -- do_test insert-2.1 {
 --   execsql {
 --     CREATE TABLE test2(
---       f1 int default -111, 
+--       f1 int default -111,
 --       f2 real default +4.32,
 --       f3 int default +222,
 --       f4 int default 7.89
@@ -165,7 +165,7 @@ end, {
 --   execsql {
 --     DROP TABLE test2;
 --     CREATE TABLE test2(
---       f1 int default 111, 
+--       f1 int default 111,
 --       f2 real default -4.32,
 --       f3 text default hi,
 --       f4 text default 'abc-123',
@@ -396,8 +396,8 @@ test:do_execsql_test("insert-4.7", [[
   -- } {}
 -- end
 
--- # Test that the special optimization for queries of the form 
--- # "SELECT max(x) FROM tbl" where there is an index on tbl(x) works with 
+-- # Test that the special optimization for queries of the form
+-- # "SELECT max(x) FROM tbl" where there is an index on tbl(x) works with
 -- # INSERT statments.
 -- do_test insert-7.1 {
 --   execsql {
diff --git a/test/sql-tap/insert3.test.lua b/test/sql-tap/insert3.test.lua
index 6e1c2b0e0..5469fe06b 100755
--- a/test/sql-tap/insert3.test.lua
+++ b/test/sql-tap/insert3.test.lua
@@ -182,7 +182,7 @@ test:do_execsql_test(
     "insert3-3.3",
     [[
             CREATE TABLE t4(id INTEGER PRIMARY KEY AUTOINCREMENT, a INT ,b INT ,c INT );
-            CREATE TRIGGER t4r1 AFTER INSERT on t4 FOR EACH ROW 
+            CREATE TRIGGER t4r1 AFTER INSERT on t4 FOR EACH ROW
             WHEN nosuchcol BEGIN
               SELECT 'illegal WHEN clause';
             END;
diff --git a/test/sql-tap/join.test.lua b/test/sql-tap/join.test.lua
index 1fc968307..4175608fd 100755
--- a/test/sql-tap/join.test.lua
+++ b/test/sql-tap/join.test.lua
@@ -324,7 +324,7 @@ test:do_execsql_test(
 test:do_execsql2_test(
     "join-1.13",
     [[
-        SELECT * FROM t1 NATURAL JOIN 
+        SELECT * FROM t1 NATURAL JOIN
           (SELECT b as c, c as d, d as e FROM t2) as t3
     ]], {
         -- <join-1.13>
@@ -564,6 +564,7 @@ test:do_catchsql_test(
         -- </join-3.4.2>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "join-3.5",
     [[
@@ -770,10 +771,10 @@ test:do_execsql_test(
 --     INSERT INTO t9 VALUES(2,22);
 --     CREATE TABLE t10(x INTEGER PRIMARY KEY, y INT);
 --     INSERT INTO t10 VALUES(1,2);
---     INSERT INTO t10 VALUES(3,3);    
+--     INSERT INTO t10 VALUES(3,3);
 --     CREATE TABLE t11(p INTEGER PRIMARY KEY, q INT);
 --     INSERT INTO t11 VALUES(2,111);
---     INSERT INTO t11 VALUES(3,333);    
+--     INSERT INTO t11 VALUES(3,333);
 --     CREATE VIEW v10_11 AS SELECT x, q FROM t10, t11 WHERE t10.y=t11.p;
 --     COMMIT;
 --     SELECT * FROM t9 LEFT JOIN v10_11 ON( a=x );
@@ -825,7 +826,7 @@ test:do_execsql_test(
         COMMIT;
     ]], {
         -- <join-9.1>
-        
+
         -- </join-9.1>
     })
 
@@ -837,7 +838,7 @@ test:do_execsql_test(
         SELECT * FROM t12 NATURAL LEFT JOIN (SELECT * FROM t13 WHERE b>0);
     ]], {
         -- <join-9.1.1>
-        
+
         -- </join-9.1.1>
     })
 
@@ -870,7 +871,7 @@ test:do_execsql_test(
            (SELECT max(m.q) FROM t22 m JOIN t21 n ON n.b=m.p WHERE n.c=1);
     ]], {
         -- <join-10.1>
-        
+
         -- </join-10.1>
     })
 
@@ -965,7 +966,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "join-11.4",
     [[
-        SELECT * FROM t1 NATURAL JOIN t1 
+        SELECT * FROM t1 NATURAL JOIN t1
     ]], {
         -- <join-11.4>
         1, "abc", 2, "def"
@@ -989,7 +990,7 @@ test:do_test(
         ]]
     end, {
         -- <join-11.5>
-        
+
         -- </join-11.5>
     })
 
@@ -1000,7 +1001,7 @@ test:do_test(
 test:do_execsql_test(
     "join-11.7",
     [[
-        SELECT a,b FROM t2 NATURAL JOIN t1 
+        SELECT a,b FROM t2 NATURAL JOIN t1
     ]], {
         -- <join-11.7>
         "one", 1, "two", 2
@@ -1024,14 +1025,14 @@ test:do_test(
         ]]
     end, {
         -- <join-11.8>
-        
+
         -- </join-11.8>
     })
 
 test:do_execsql_test(
     "join-11.9",
     [[
-        SELECT * FROM t1 NATURAL JOIN t2 
+        SELECT * FROM t1 NATURAL JOIN t2
     ]], {
         -- <join-11.9>
         "one", "1", "two", "2"
@@ -1041,7 +1042,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "join-11.10",
     [[
-        SELECT * FROM t2 NATURAL JOIN t1 
+        SELECT * FROM t2 NATURAL JOIN t1
     ]], {
         -- <join-11.10>
         1, "one", 2, "two"
diff --git a/test/sql-tap/join3.test.lua b/test/sql-tap/join3.test.lua
index 4aa8c94a3..f60e9a62e 100755
--- a/test/sql-tap/join3.test.lua
+++ b/test/sql-tap/join3.test.lua
@@ -29,7 +29,7 @@ local bitmask_size = 64
 
 local result = {}
 --for _ in X(0, "X!for", [=[["set N 1","$N<=$bitmask_size","incr N"]]=]) do
-for N=1, bitmask_size do 
+for N=1, bitmask_size do
     table.insert(result,N) -- or result
     test:do_test(
         "join3-1."..N,
@@ -42,7 +42,7 @@ for N=1, bitmask_size do
                 sql = sql .. ", t"..i..""
             end
             return test:execsql(sql)
-        end, 
+        end,
         result
         )
 
diff --git a/test/sql-tap/join6.test.lua b/test/sql-tap/join6.test.lua
index 9ccb8673c..93139dfda 100755
--- a/test/sql-tap/join6.test.lua
+++ b/test/sql-tap/join6.test.lua
@@ -44,7 +44,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "join6-1.2",
     [[
-        SELECT t1.a, t3.b 
+        SELECT t1.a, t3.b
           FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.a=t3.a;
     ]], {
         -- <join6-1.2>
diff --git a/test/sql-tap/keyword1.test.lua b/test/sql-tap/keyword1.test.lua
index 4e5fc5fd8..f9a9c6865 100755
--- a/test/sql-tap/keyword1.test.lua
+++ b/test/sql-tap/keyword1.test.lua
@@ -48,7 +48,7 @@ local kwlist = {
 	"disable"
 }
 
-local bannedkws = { 
+local bannedkws = {
 	"all",
 	"alter",
 	"analyze",
diff --git a/test/sql-tap/limit.test.lua b/test/sql-tap/limit.test.lua
index a1b24ab19..7173df55f 100755
--- a/test/sql-tap/limit.test.lua
+++ b/test/sql-tap/limit.test.lua
@@ -185,7 +185,7 @@ test:do_execsql_test(
         SELECT x FROM t1 ORDER BY x LIMIT 50 OFFSET 50
     ]], {
         -- <limit-1.5>
-        
+
         -- </limit-1.5>
     })
 
@@ -474,7 +474,7 @@ test:do_execsql_test(
         SELECT * FROM t6 LIMIT 0
     ]], {
         -- <limit-6.7>
-        
+
         -- </limit-6.7>
     })
 
@@ -484,7 +484,7 @@ test:do_execsql_test(
         SELECT * FROM t6 LIMIT 0 OFFSET 1
     ]], {
         -- <limit-6.8>
-        
+
         -- </limit-6.8>
     })
 
@@ -570,7 +570,7 @@ test:do_execsql_test(
 -- } {31}
 -- do_test limit-7.12 {
 --   execsql {
---     SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2 
+--     SELECT a+27 FROM t6 INTERSECT SELECT x FROM t2
 --        ORDER BY 1 DESC LIMIT 1 OFFSET 1;
 --   }
 -- } {30}
@@ -631,7 +631,7 @@ test:do_execsql_test(
         INSERT INTO t7 SELECT * FROM t6;
     ]], {
         -- <limit-9.2.1>
-        
+
         -- </limit-9.2.1>
     })
 
@@ -756,7 +756,7 @@ test:do_test(
         ]]
     end, {
         -- <limit-11.1>
-        
+
         -- </limit-11.1>
     })
 
@@ -805,7 +805,7 @@ test:do_catchsql_test(
     })
 
 -- Ticket [db4d96798da8b]
--- LIMIT does not work with nested views containing UNION ALL 
+-- LIMIT does not work with nested views containing UNION ALL
 --
 test:do_test(
     "limit-13.1",
@@ -819,7 +819,7 @@ test:do_test(
         ]]
     end, {
         -- <limit-13.1>
-        
+
         -- </limit-13.1>
     })
 
@@ -1269,7 +1269,7 @@ test:do_test(
         return test:execsql "SELECT z FROM v13c LIMIT 1 OFFSET 8"
     end, {
         -- <limit-13.81>
-        
+
         -- </limit-13.81>
     })
 
@@ -1289,7 +1289,7 @@ test:do_execsql_test(
         SELECT 123 LIMIT 1 OFFSET 1
     ]], {
         -- <limit-14.2>
-        
+
         -- </limit-14.2>
     })
 
@@ -1299,7 +1299,7 @@ test:do_execsql_test(
         SELECT 123 LIMIT 0 OFFSET 0
     ]], {
         -- <limit-14.3>
-        
+
         -- </limit-14.3>
     })
 
@@ -1309,7 +1309,7 @@ test:do_execsql_test(
         SELECT 123 LIMIT 0 OFFSET 1
     ]], {
         -- <limit-14.4>
-        
+
         -- </limit-14.4>
     })
 
diff --git a/test/sql-tap/minmax3.test.lua b/test/sql-tap/minmax3.test.lua
index 90f4f6020..1a7794d99 100755
--- a/test/sql-tap/minmax3.test.lua
+++ b/test/sql-tap/minmax3.test.lua
@@ -299,14 +299,14 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(11, 3, 3);
     ]], {
         -- <minmax3-2.1>
-        
+
         -- </minmax3-2.1>
     })
 
 test:do_execsql_test(
     "minmax3-2.2",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-2.2>
         1
@@ -316,7 +316,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.3",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>1;
     ]], {
         -- <minmax3-2.3>
         2
@@ -326,7 +326,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.4",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1;
     ]], {
         -- <minmax3-2.4>
         1
@@ -336,7 +336,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.5",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-2.5>
         1
@@ -346,7 +346,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.6",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<2; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<2;
     ]], {
         -- <minmax3-2.6>
         1
@@ -356,7 +356,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.7",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<1;
     ]], {
         -- <minmax3-2.7>
         ""
@@ -366,7 +366,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-2.8",
     [[
-        SELECT min(b) FROM t2 WHERE a = 3 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 3 AND b<1;
     ]], {
         -- <minmax3-2.8>
         ""
@@ -392,14 +392,14 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(11, 3, 3);
     ]], {
         -- <minmax3-3.1>
-        
+
         -- </minmax3-3.1>
     })
 
 test:do_execsql_test(
     "minmax3-3.2",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-3.2>
         1
@@ -409,7 +409,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.3",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>1;
     ]], {
         -- <minmax3-3.3>
         2
@@ -419,7 +419,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.4",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b>-1;
     ]], {
         -- <minmax3-3.4>
         1
@@ -429,7 +429,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.5",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1; 
+        SELECT min(b) FROM t2 WHERE a = 1;
     ]], {
         -- <minmax3-3.5>
         1
@@ -439,7 +439,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.6",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<2; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<2;
     ]], {
         -- <minmax3-3.6>
         1
@@ -449,7 +449,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.7",
     [[
-        SELECT min(b) FROM t2 WHERE a = 1 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 1 AND b<1;
     ]], {
         -- <minmax3-3.7>
         ""
@@ -459,7 +459,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "minmax3-3.8",
     [[
-        SELECT min(b) FROM t2 WHERE a = 3 AND b<1; 
+        SELECT min(b) FROM t2 WHERE a = 3 AND b<1;
     ]], {
         -- <minmax3-3.8>
         ""
diff --git a/test/sql-tap/minmax4.test.lua b/test/sql-tap/minmax4.test.lua
index 1674a7753..3a71462e0 100755
--- a/test/sql-tap/minmax4.test.lua
+++ b/test/sql-tap/minmax4.test.lua
@@ -14,11 +14,11 @@ test:plan(21)
 --
 -------------------------------------------------------------------------
 --
--- Test for queries of the form:  
+-- Test for queries of the form:
 --
 --    SELECT p, max(q) FROM t1;
 --
--- Demonstration that the value returned for p is on the same row as 
+-- Demonstration that the value returned for p is on the same row as
 -- the maximum q.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index b1c4f026b..175ad5b92 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -226,7 +226,7 @@ test:do_test(
         return test.lindex(r, 1)
     end, {
         -- <misc1-3.1>
-        
+
         -- </misc1-3.1>
     })
 
@@ -766,7 +766,7 @@ test:do_execsql_test(
 end
 
 -- There was a problem with realloc() in the OP_MemStore operation of
--- the VDBE.  A buffer was being reallocated but some pointers into 
+-- the VDBE.  A buffer was being reallocated but some pointers into
 -- the old copy of the buffer were not being moved over to the new copy.
 -- The following code tests for the problem.
 --
@@ -946,7 +946,7 @@ if (0 > 0) then
             CREATE TABLE RealTable(TestID INTEGER PRIMARY KEY, TestString TEXT);
             CREATE TABLE TempTable(TestID INTEGER PRIMARY KEY, TestString TEXT);
             CREATE TRIGGER trigTest_1 AFTER UPDATE ON TempTable BEGIN
-              INSERT INTO RealTable(TestString) 
+              INSERT INTO RealTable(TestString)
                  SELECT new.TestString FROM TempTable LIMIT 1;
             END;
             INSERT INTO TempTable(TestString) VALUES ('1');
@@ -1078,7 +1078,7 @@ test:do_catchsql_test(
 --   ROLLBACK;
 --   DROP TABLE IF EXISTS t;
 -- } {0 {}}
--- # At one point, running this would read one byte passed the end of a 
+-- # At one point, running this would read one byte passed the end of a
 -- # buffer, upsetting valgrind.
 -- #
 -- do_test misc1-24.0 {
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 62678bbbd..70c605ef8 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -21,7 +21,7 @@ test:plan(31)
 -- $Id: misc5.test,v 1.22 2008/07/29 10:26:45 danielk1977 Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
--- Build records using the MakeRecord opcode such that the size of the 
+-- Build records using the MakeRecord opcode such that the size of the
 -- header is at the transition point in the size of a varint.
 --
 -- This test causes an assertion failure or a buffer overrun in version
@@ -44,7 +44,7 @@ for i = 120, 140 - 1, 1 do
             sql2 = sql2 .. ");"
             return test:execsql(string.format("%s%s", sql1, sql2))
         end, {
-            
+
         })
 
 end
@@ -160,33 +160,33 @@ test:do_execsql_test(
         INSERT INTO songs VALUES(4,'three',5);
         INSERT INTO songs VALUES(5,'one',7);
         INSERT INTO songs VALUES(6,'two',11);
-        SELECT DISTINCT artist 
-        FROM (    
-         SELECT DISTINCT artist    
-         FROM songs      
-         WHERE songid IN (    
-          SELECT songid    
-          FROM songs    
+        SELECT DISTINCT artist
+        FROM (
+         SELECT DISTINCT artist
+         FROM songs
+         WHERE songid IN (
+          SELECT songid
+          FROM songs
           WHERE LOWER(artist) IN (
-            SELECT DISTINCT LOWER(artist)    
-            FROM (      
+            SELECT DISTINCT LOWER(artist)
+            FROM (
               -- This sub-query returns the table:
               --
               --     two      14
               --     one      10
               --     three    5
               --
-              SELECT DISTINCT artist,sum(timesplayed) AS total      
-              FROM songs      
-              GROUP BY LOWER(artist)      
-              ORDER BY total DESC      
-              LIMIT 10    
-            )    
+              SELECT DISTINCT artist,sum(timesplayed) AS total
+              FROM songs
+              GROUP BY LOWER(artist)
+              ORDER BY total DESC
+              LIMIT 10
+            )
             WHERE artist <> ''
           )
          )
          LIMIT 1
-        )  
+        )
         ORDER BY LOWER(artist) ASC;
     ]], {
         -- <misc5-3.1>
@@ -217,7 +217,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.1",
     [[
-        SELECT .1 
+        SELECT .1
     ]], {
         -- <misc5-5.1>
         0.1
@@ -227,7 +227,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.2",
     [[
-        SELECT 2. 
+        SELECT 2.
     ]], {
         -- <misc5-5.2>
         2.0
@@ -237,7 +237,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "misc5-5.3",
     [[
-        SELECT 3.e0 
+        SELECT 3.e0
     ]], {
         -- <misc5-5.3>
         3.0
@@ -264,7 +264,7 @@ test:drop_all_tables()
 -- do_test misc5-6.1 {
 --   catchsql {
 --     SELECT * FROM sql_master
---     UNION ALL 
+--     UNION ALL
 --     SELECT * FROM sql_master
 --     LIMIT (SELECT count(*) FROM blah);
 --   }
@@ -274,9 +274,9 @@ test:drop_all_tables()
 --     CREATE TABLE logs(msg TEXT, timestamp INTEGER, dbtime TEXT);
 --   }
 --   catchsql {
---     SELECT * FROM logs WHERE logs.oid >= (SELECT head FROM logs_base) 
---     UNION ALL 
---     SELECT * FROM logs 
+--     SELECT * FROM logs WHERE logs.oid >= (SELECT head FROM logs_base)
+--     UNION ALL
+--     SELECT * FROM logs
 --     LIMIT (SELECT lmt FROM logs_base) ;
 --   }
 -- } {1 {no such table: logs_base}}
@@ -993,7 +993,7 @@ test:do_test(
             SELECT x FROM t3 ORDER BY x;
         ]]
     end, {
-        -- <misc5-11.1> 
+        -- <misc5-11.1>
     -9223372036854775808LL, -9223372036854775807LL, -9223372036854775806LL, -4611686018427387906LL,
  -4611686018427387905LL, -4611686018427387904LL, -4611686018427387903LL, -4611686018427387902LL,
  -2305843009213693954LL, -2305843009213693953LL, -2305843009213693952LL, -2305843009213693951LL,
diff --git a/test/sql-tap/null.test.lua b/test/sql-tap/null.test.lua
index a1f33f5ad..ca20e3558 100755
--- a/test/sql-tap/null.test.lua
+++ b/test/sql-tap/null.test.lua
@@ -153,7 +153,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "null-3.1",
     [[
-        select count(*), count(b), count(c), sum(b), sum(c), 
+        select count(*), count(b), count(c), sum(b), sum(c),
                avg(b), avg(c), min(b), max(b) from t1;
     ]], {
         -- <null-3.1>
@@ -353,7 +353,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y=NULL;
     ]], {
         -- <null-8.1>
-        
+
         -- </null-8.1>
     })
 
@@ -363,7 +363,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y IN (33,NULL);
     ]], {
         -- <null-8.2>
-        
+
         -- </null-8.2>
     })
 
@@ -406,7 +406,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y=NULL;
     ]], {
         -- <null-8.11>
-        
+
         -- </null-8.11>
     })
 
@@ -416,7 +416,7 @@ test:do_execsql_test(
         SELECT x FROM t4 WHERE y IN (33,NULL);
     ]], {
         -- <null-8.12>
-        
+
         -- </null-8.12>
     })
 
diff --git a/test/sql-tap/offset1.test.lua b/test/sql-tap/offset1.test.lua
index 194c3a735..fe4ca1940 100755
--- a/test/sql-tap/offset1.test.lua
+++ b/test/sql-tap/offset1.test.lua
@@ -13,7 +13,7 @@ test:plan(22)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- This file implements test cases for the [b65cb2c8d91f6685841d7d1e13b6]
 -- bug:  Correct handling of LIMIT and OFFSET on a UNION ALL query where
 -- the right-hand SELECT contains an ORDER BY in a subquery.
@@ -162,7 +162,7 @@ test:do_execsql_test(
         LIMIT 3 OFFSET 9;
     ]], {
         -- <offset1-1.2.9>
-        
+
         -- </offset1-1.2.9>
     })
 
@@ -172,7 +172,7 @@ test:do_execsql_test(
         SELECT * FROM t1 LIMIT 0;
     ]], {
         -- <offset1-1.3.0>
-        
+
         -- </offset1-1.3.0>
     })
 
@@ -185,7 +185,7 @@ test:do_execsql_test(
         LIMIT 0 OFFSET 1;
     ]], {
         -- <offset1-1.4.0>
-        
+
         -- </offset1-1.4.0>
     })
 
diff --git a/test/sql-tap/orderby1.test.lua b/test/sql-tap/orderby1.test.lua
index f2b0fa06e..33f437670 100755
--- a/test/sql-tap/orderby1.test.lua
+++ b/test/sql-tap/orderby1.test.lua
@@ -53,7 +53,7 @@ test:do_test(
         ]]
     end, {
         -- <1.0>
-        
+
         -- </1.0>
     })
 
@@ -271,7 +271,7 @@ test:do_test(
         -- </1.6c>
     })
 
--- ORDER BY 
+-- ORDER BY
 -- # Reconstruct the test data to use indices rather than integer primary keys.
 -- #
 -- do_test 2.0 {
@@ -440,7 +440,7 @@ test:do_test(
         ]]
     end, {
         -- <3.0>
-        
+
         -- </3.0>
     })
 
@@ -687,7 +687,7 @@ test:do_execsql_test(
         EXPLAIN QUERY PLAN SELECT 5 ORDER BY 1
     ]], {
         -- <5.0>
-        
+
         -- </5.0>
     })
 
@@ -733,7 +733,7 @@ test:do_execsql_test(
         INSERT INTO abc VALUES(4, 5, 6);
         INSERT INTO abc VALUES(7, 8, 9);
         SELECT (
-          SELECT 'hardware' FROM ( 
+          SELECT 'hardware' FROM (
             SELECT 'software' ORDER BY 'firmware' ASC, 'sportswear' DESC
           ) GROUP BY 1 HAVING length(b) <> 0
         )
diff --git a/test/sql-tap/orderby6.test.lua b/test/sql-tap/orderby6.test.lua
index 8d4a0507b..ab6f36dc9 100755
--- a/test/sql-tap/orderby6.test.lua
+++ b/test/sql-tap/orderby6.test.lua
@@ -47,7 +47,7 @@ test:plan(34)
                 INSERT INTO t1 SELECT x, x%40, x/40 FROM cnt;
             ]]
         end, {
-            
+
         })
 
     -- Run various ORDER BY queries that can benefit from block-sort.
@@ -55,10 +55,10 @@ test:plan(34)
     -- by adding + to each term of the ORDER BY clause.
     --
     test:do_execsql_test(
-        "1.2", 
+        "1.2",
         [[
             SELECT b,a,c FROM t1 ORDER BY b,a,c;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b,+a,+c"
         )
 
@@ -66,7 +66,7 @@ test:plan(34)
         "1.3",
         [[
             SELECT b,a,c FROM t1 ORDER BY b,c DESC,a;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b,+c DESC,+a"
         )
 
@@ -74,7 +74,7 @@ test:plan(34)
         "1.4",
         [[
             SELECT b,a,c FROM t1 ORDER BY b DESC,c,a;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b DESC,+c,+a"
         )
 
@@ -82,7 +82,7 @@ test:plan(34)
         "1.5",
         [[
             SELECT b,a,c FROM t1 ORDER BY b DESC,a,c;
-        ]], 
+        ]],
         test:execsql "SELECT b,a,c FROM t1 ORDER BY +b DESC,+a,+c"
         )
 
@@ -228,14 +228,14 @@ test:plan(34)
                                 FROM cnt;
             ]]
         end, {
-            
+
         })
 
     test:do_execsql_test(
         "1.32",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -243,7 +243,7 @@ test:plan(34)
         "1.33",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -251,7 +251,7 @@ test:plan(34)
         "1.34",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,+e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -259,7 +259,7 @@ test:plan(34)
         "1.35",
         [[
             SELECT a FROM t2 ORDER BY b,c,+d,+e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -267,7 +267,7 @@ test:plan(34)
         "1.36",
         [[
             SELECT a FROM t2 ORDER BY b,+c,+d,+e,+f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f;"
         )
 
@@ -275,7 +275,7 @@ test:plan(34)
         "1.37",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e,f DESC;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e,+f DESC;"
         )
 
@@ -283,7 +283,7 @@ test:plan(34)
         "1.38",
         [[
             SELECT a FROM t2 ORDER BY b,c,d,e DESC,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d,+e DESC,+f;"
         )
 
@@ -291,7 +291,7 @@ test:plan(34)
         "1.39",
         [[
             SELECT a FROM t2 ORDER BY b,c,d DESC,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c,+d DESC,+e,+f;"
         )
 
@@ -299,7 +299,7 @@ test:plan(34)
         "1.40",
         [[
             SELECT a FROM t2 ORDER BY b,c DESC,d,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b,+c DESC,+d,+e,+f;"
         )
 
@@ -307,7 +307,7 @@ test:plan(34)
         "1.41",
         [[
             SELECT a FROM t2 ORDER BY b DESC,c,d,e,f;
-        ]], 
+        ]],
         test:execsql "SELECT a FROM t2 ORDER BY +b DESC,+c,+d,+e,+f;"
         )
     -- Tests are commented because of the reason described in
diff --git a/test/sql-tap/orderby9.test.lua b/test/sql-tap/orderby9.test.lua
index 6957ed098..96872dbd3 100755
--- a/test/sql-tap/orderby9.test.lua
+++ b/test/sql-tap/orderby9.test.lua
@@ -14,7 +14,7 @@ test:plan(4)
 --
 -------------------------------------------------------------------------
 -- This file implements regression tests for sql library.
--- 
+--
 -- This file seeks to verify that expressions (and especially functions)
 -- that are in both the ORDER BY clause and the result set are only
 -- evaluated once.
@@ -36,7 +36,7 @@ test:do_test(
     1.0,
     function()
         -- If random() is only evaluated once and then reused for each row, then
-        -- the output should appear in sorted order.  If random() is evaluated 
+        -- the output should appear in sorted order.  If random() is evaluated
         -- separately for the result set and the ORDER BY clause, then the output
         -- order will be random.
         local l1 = test:execsql("SELECT random() AS y FROM t1 ORDER BY 1;")
diff --git a/test/sql-tap/resolver01.test.lua b/test/sql-tap/resolver01.test.lua
index 66db0f004..1ab1116cb 100755
--- a/test/sql-tap/resolver01.test.lua
+++ b/test/sql-tap/resolver01.test.lua
@@ -314,17 +314,17 @@ test:do_execsql_test(
         SELECT min(name) FROM t61 GROUP BY lower(name);
     ]], {
         -- <resolver01-6.1>
-        
+
         -- </resolver01-6.1>
     })
 
 test:do_execsql_test(
     "resolver01-6.2",
     [[
-        SELECT min(name) AS name FROM t61 GROUP BY lower(name); 
+        SELECT min(name) AS name FROM t61 GROUP BY lower(name);
     ]], {
         -- <resolver01-6.2>
-        
+
         -- </resolver01-6.2>
     })
 
@@ -360,7 +360,7 @@ test:do_execsql_test(
         SELECT 2 AS x WHERE (SELECT x AS y WHERE 1>y);
     ]], {
         -- <resolver01-7.2>
-        
+
         -- </resolver01-7.2>
     })
 
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 2f61ae0ec..b812c5565 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -351,7 +351,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT LEAST(f1,f2) FROM test1"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-2.8>
@@ -416,7 +416,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT GREATEST(f1,f2) FROM test1"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-2.11>
@@ -431,7 +431,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT GREATEST(f1,f2)+1 FROM test1"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-2.12>
@@ -623,7 +623,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE f1>=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.4>
@@ -638,7 +638,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE f1>11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.5>
@@ -653,7 +653,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE f1!=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.6>
@@ -668,7 +668,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE LEAST(f1,f2)!=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.7>
@@ -683,7 +683,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql "SELECT f1 FROM test1 WHERE GREATEST(f1,f2)!=11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         return table.insert(v,table.sort(msg) or msg) or v
     end, {
         -- <select1-3.8>
@@ -957,7 +957,7 @@ test:do_test(
         local v = pcall(function()
             msg = test:execsql2 "SELECT DISTINCT * FROM test1 WHERE f1==11"
             end)
-        v = v == true and {0} or {1} 
+        v = v == true and {0} or {1}
         set_full_column_names(false)
         return table.insert(v,msg) or v
     end, {
@@ -1065,7 +1065,7 @@ test:do_test(
 
 test:do_catchsql2_test(
     "select1-6.6",
-    [[SELECT test1.f1+F2, t1 FROM test1, test2 
+    [[SELECT test1.f1+F2, t1 FROM test1, test2
          ORDER BY f2]], {
         -- <select1-6.6>
         0, {"COLUMN_1",33,"T1","abc","COLUMN_1",77,"T1","abc"}
@@ -1074,7 +1074,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.7",
-    [[SELECT A.f1, t1 FROM test1 as A, test2 
+    [[SELECT A.f1, t1 FROM test1 as A, test2
          ORDER BY f2]], {
         -- <select1-6.7>
         0, {"F1", 11, "T1", "abc", "F1", 33, "T1", "abc"}
@@ -1083,7 +1083,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.8",
-    [[SELECT A.f1, f1 FROM test1 as A, test1 as B 
+    [[SELECT A.f1, f1 FROM test1 as A, test1 as B
          ORDER BY f2]], {
         -- <select1-6.8>
         1, "ambiguous column name: F1"
@@ -1092,7 +1092,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.8b",
-    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B 
+    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B
          ORDER BY f2]], {
         -- <select1-6.8b>
         1, "ambiguous column name: F2"
@@ -1101,7 +1101,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql2_test(
     "select1-6.8c",
-    [[SELECT A.f1, f1 FROM test1 as A, test1 as A 
+    [[SELECT A.f1, f1 FROM test1 as A, test1 as A
          ORDER BY f2]], {
         -- <select1-6.8c>
         1, "ambiguous column name: A.F1"
@@ -1110,7 +1110,7 @@ test:do_catchsql2_test(
 
 test:do_catchsql_test(
     "select1-6.9.1",
-    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B 
+    [[SELECT A.f1, B.f1 FROM test1 as A, test1 as B
          ORDER BY A.f1, B.f1]], {
         -- <select1-6.9.1>
         0, {11, 11, 11, 33, 33, 11, 33, 33}
@@ -1334,7 +1334,7 @@ test:do_catchsql2_test(
                 INSERT INTO t6 VALUES('b','1');
                 INSERT INTO t6 VALUES('c','2');
                 INSERT INTO t6 VALUES('d','3');
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY 1 LIMIT 1)
             ]], {
@@ -1346,7 +1346,7 @@ test:do_catchsql2_test(
         test:do_execsql_test(
             "select1-6.21",
             [[
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY 1 DESC LIMIT 1)
             ]], {
@@ -1358,7 +1358,7 @@ test:do_catchsql2_test(
         test:do_execsql_test(
             "select1-6.22",
             [[
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY b LIMIT 2)
                 ORDER BY a;
@@ -1371,7 +1371,7 @@ test:do_catchsql2_test(
         test:do_catchsql_test(
             "select1-6.23",
             [[
-                SELECT a FROM t6 WHERE b IN 
+                SELECT a FROM t6 WHERE b IN
                    (SELECT b FROM t6 WHERE a<='b' UNION SELECT '3' AS x
                             ORDER BY x DESC LIMIT 2)
                 ORDER BY a;
@@ -1887,7 +1887,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(0,'1','2');
     ]], {
         -- <select1-12.4>
-        
+
         -- </select1-12.4>
     })
 
@@ -1911,7 +1911,7 @@ test:do_execsql_test(
             -- </select1-12.6>
         })
 
-    -- 
+    --
 
 
 -- ifcapable compound
@@ -2001,7 +2001,7 @@ test:do_test(
 -- db close
 -- sql db test.db
 -- do_test select1-14.1 {
---   execsql { 
+--   execsql {
 --     SELECT * FROM sql_master WHERE rowid>10;
 --     SELECT * FROM sql_master WHERE rowid=10;
 --     SELECT * FROM sql_master WHERE rowid<10;
@@ -2011,7 +2011,7 @@ test:do_test(
 --   }
 -- } {}
 -- do_test select1-14.2 {
---   execsql { 
+--   execsql {
 --     SELECT 10 IN (SELECT rowid FROM sql_master);
 --   }
 -- } {0}
@@ -2034,7 +2034,7 @@ test:do_test(
             INSERT INTO t1 VALUES(3, 3);
         ]], {
             -- <select1-15.1>
-            
+
             -- </select1-15.1>
         })
 
@@ -2046,7 +2046,7 @@ test:do_test(
     test:do_execsql_test(
         "select1-15.3",
         [[
-            SELECT 2 IN (SELECT a FROM t1) 
+            SELECT 2 IN (SELECT a FROM t1)
         ]], {
             -- <select1-15.3>
             true
diff --git a/test/sql-tap/select3.test.lua b/test/sql-tap/select3.test.lua
index 258ac8000..ffba58ec2 100755
--- a/test/sql-tap/select3.test.lua
+++ b/test/sql-tap/select3.test.lua
@@ -215,9 +215,9 @@ test:do_execsql_test("select3-4.1", [[
 })
 
 test:do_execsql_test("select3-4.2", [[
-  SELECT log, count(*) FROM t1 
-  GROUP BY log 
-  HAVING count(*)>=4 
+  SELECT log, count(*) FROM t1
+  GROUP BY log
+  HAVING count(*)>=4
   ORDER BY log
 ]], {
   -- <select3-4.2>
@@ -226,9 +226,9 @@ test:do_execsql_test("select3-4.2", [[
 })
 
 test:do_execsql_test("select3-4.3", [[
-  SELECT log, count(*) FROM t1 
-  GROUP BY log 
-  HAVING count(*)>=4 
+  SELECT log, count(*) FROM t1
+  GROUP BY log
+  HAVING count(*)>=4
   ORDER BY max(n)+0
 ]], {
   -- <select3-4.3>
@@ -237,9 +237,9 @@ test:do_execsql_test("select3-4.3", [[
 })
 
 test:do_execsql_test("select3-4.4", [[
-  SELECT log AS x, count(*) AS y FROM t1 
+  SELECT log AS x, count(*) AS y FROM t1
   GROUP BY x
-  HAVING y>=4 
+  HAVING y>=4
   ORDER BY max(n)+0
 ]], {
   -- <select3-4.4>
@@ -248,9 +248,9 @@ test:do_execsql_test("select3-4.4", [[
 })
 
 test:do_execsql_test("select3-4.5", [[
-  SELECT log AS x FROM t1 
+  SELECT log AS x FROM t1
   GROUP BY x
-  HAVING count(*)>=4 
+  HAVING count(*)>=4
   ORDER BY max(n)+0
 ]], {
   -- <select3-4.5>
@@ -259,8 +259,8 @@ test:do_execsql_test("select3-4.5", [[
 })
 
 test:do_execsql_test("select3-5.1", [[
-  SELECT log, count(*), avg(n), max(n+log*2) FROM t1 
-  GROUP BY log 
+  SELECT log, count(*), avg(n), max(n+log*2) FROM t1
+  GROUP BY log
   ORDER BY max(n+log*2)+0, avg(n)+0
 ]], {
   -- <select3-5.1>
@@ -269,8 +269,8 @@ test:do_execsql_test("select3-5.1", [[
 })
 
 test:do_execsql_test("select3-5.2", [[
-  SELECT log, count(*), avg(n), max(n+log*2) FROM t1 
-  GROUP BY log 
+  SELECT log, count(*), avg(n), max(n+log*2) FROM t1
+  GROUP BY log
   ORDER BY max(n+log*2)+0, GREATEST(log,avg(n))+0
 ]], {
   -- <select3-5.2>
@@ -355,7 +355,7 @@ test:do_execsql_test("select3-7.1", [[
   SELECT a, sum(b) FROM t2 WHERE b=5 GROUP BY a;
 ]], {
   -- <select3-7.1>
-  
+
   -- </select3-7.1>
 })
 
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index e2b13090d..465800940 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -125,7 +125,7 @@ test:do_execsql_test(
 
 -- do_test select4-1.1g {
 --   execsql {
---     CREATE TABLE t2 AS 
+--     CREATE TABLE t2 AS
 --       SELECT DISTINCT log FROM t1
 --       UNION ALL
 --       SELECT n FROM t1 WHERE log=2;
@@ -136,7 +136,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-1.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 UNION ALL
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -193,7 +193,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-2.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 UNION
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -255,7 +255,7 @@ test:do_execsql_test(
 
 -- do_test select4-3.1.2 {
 --   execsql {
---     CREATE TABLE t2 AS 
+--     CREATE TABLE t2 AS
 --       SELECT DISTINCT log FROM t1
 --       EXCEPT
 --       SELECT n FROM t1 WHERE log=3
@@ -266,7 +266,7 @@ test:do_execsql_test(
 -- execsql {DROP TABLE t2}
 -- do_test select4-3.1.3 {
 --   execsql {
---     CREATE TABLE t2 AS 
+--     CREATE TABLE t2 AS
 --       SELECT DISTINCT log FROM t1
 --       EXCEPT
 --       SELECT n FROM t1 WHERE log=3
@@ -278,7 +278,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-3.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 EXCEPT
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -358,7 +358,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select4-4.2",
     [[
-        SELECT log FROM t1 WHERE n IN 
+        SELECT log FROM t1 WHERE n IN
           (SELECT DISTINCT log FROM t1 INTERSECT
            SELECT n FROM t1 WHERE log=3)
         ORDER BY log;
@@ -390,7 +390,7 @@ test:do_catchsql_test(
           SELECT 0 ORDER BY 1
           INTERSECT
           SELECT 1
-          INTERSECT 
+          INTERSECT
           SELECT 2
           ORDER BY 1
         );
@@ -699,7 +699,7 @@ test:do_execsql_test(
         SELECT NULL EXCEPT SELECT NULL
     ]], {
         -- <select4-6.7>
-        
+
         -- </select4-6.7>
     })
 
@@ -714,7 +714,7 @@ INSERT INTO t2 VALUES (0, 1), (1, 1), (2, 2), (3, 4), (4, 8), (5, 15);]]
 --     CREATE TABLE t2 AS SELECT log AS 'x', count INT (*) AS 'y' FROM t1 GROUP BY log;
 --     SELECT * FROM t2 ORDER BY x;
 --   }
--- } {0 1 1 1 2 2 3 4 4 8 5 15}  
+-- } {0 1 1 1 2 2 3 4 4 8 5 15}
 test:do_execsql2_test(
     "select4-7.2",
     [[
@@ -911,7 +911,7 @@ test:do_execsql2_test(
          WHERE b=3
     ]], {
         -- <select4-9.9.2>
-        
+
         -- </select4-9.9.2>
     })
 
@@ -980,7 +980,7 @@ test:do_execsql_test(
         SELECT DISTINCT log FROM t1 ORDER BY log LIMIT 0
     ]], {
         -- <select4-10.3>
-        
+
         -- </select4-10.3>
     })
 
@@ -1038,7 +1038,7 @@ test:do_execsql_test(
         SELECT DISTINCT log FROM t1 ORDER BY +log LIMIT 3 OFFSET 20
     ]], {
         -- <select4-10.7>
-        
+
         -- </select4-10.7>
     })
 
@@ -1048,7 +1048,7 @@ test:do_execsql_test(
         SELECT DISTINCT log FROM t1 ORDER BY log LIMIT 0 OFFSET 3
     ]], {
         -- <select4-10.8>
-        
+
         -- </select4-10.8>
     })
 
@@ -1372,7 +1372,7 @@ test:do_execsql_test(
         SELECT * FROM t14 EXCEPT VALUES(1,2,3) EXCEPT VALUES(4,5,6)
     ]], {
         -- <select4-14.7>
-        
+
         -- </select4-14.7>
     })
 
diff --git a/test/sql-tap/select5.test.lua b/test/sql-tap/select5.test.lua
index 2902def37..5882102c9 100755
--- a/test/sql-tap/select5.test.lua
+++ b/test/sql-tap/select5.test.lua
@@ -198,7 +198,7 @@ test:do_execsql_test(
 
 -- Some tests for queries with a GROUP BY clause but no aggregate functions.
 --
--- Note: The query in test cases 5.1 through 5.5 are not legal SQL. So if the 
+-- Note: The query in test cases 5.1 through 5.5 are not legal SQL. So if the
 -- implementation changes in the future and it returns different results,
 -- this is not such a big deal.
 --
@@ -213,7 +213,7 @@ test:do_execsql_test(
         CREATE INDEX t2_idx ON t2(a);
     ]], {
         -- <select5-5.1>
-        
+
         -- </select5-5.1>
     })
 
@@ -384,7 +384,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select5-8.6",
     [[
-        SELECT a, count(t8a.b) FROM t8a, t8b WHERE b=t8b.rowid 
+        SELECT a, count(t8a.b) FROM t8a, t8b WHERE b=t8b.rowid
          GROUP BY a ORDER BY 2;
     ]], {
         -- <select5-8.6>
diff --git a/test/sql-tap/select6.test.lua b/test/sql-tap/select6.test.lua
index 82505f034..8ad91390a 100755
--- a/test/sql-tap/select6.test.lua
+++ b/test/sql-tap/select6.test.lua
@@ -354,7 +354,7 @@ test:do_execsql_test(
         WHERE a<10
     ]], {
         -- <select6-3.7>
-        
+
         -- </select6-3.7>
     })
 
@@ -376,7 +376,7 @@ test:do_execsql_test(
         WHERE a<10
     ]], {
         -- <select6-3.9>
-        
+
         -- </select6-3.9>
     })
 
@@ -394,7 +394,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-3.11",
     [[
-        SELECT a,b,a+b FROM 
+        SELECT a,b,a+b FROM
            (SELECT avg(x) as a, y as b FROM t1 GROUP BY b)
         WHERE b<4 ORDER BY a
     ]], {
@@ -406,7 +406,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-3.12",
     [[
-        SELECT a,b,a+b FROM 
+        SELECT a,b,a+b FROM
            (SELECT avg(x) as a, y as b FROM t1 GROUP BY b HAVING a>1)
         WHERE b<4 ORDER BY a
     ]], {
@@ -418,7 +418,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-3.13",
     [[
-        SELECT a,b,a+b FROM 
+        SELECT a,b,a+b FROM
            (SELECT avg(x) as a, y as b FROM t1 GROUP BY b HAVING a>1)
         ORDER BY a
     ]], {
@@ -452,7 +452,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-4.1",
     [[
-        SELECT a,b,c FROM 
+        SELECT a,b,c FROM
           (SELECT x AS a, y AS b, x+y AS c FROM t1 WHERE y=4)
         WHERE a<10 ORDER BY a;
     ]], {
@@ -633,7 +633,7 @@ test:do_execsql_test(
         SELECT c,b,a,* FROM (SELECT 1 AS a, 2 AS b, 'abc' AS c WHERE false)
     ]], {
         -- <select6-7.3>
-        
+
         -- </select6-7.3>
     })
 
@@ -704,7 +704,7 @@ test:do_execsql_test(
         -- </select6-8.2>
     })
 
--- If view support is omitted from the build, then so is the query 
+-- If view support is omitted from the build, then so is the query
 -- "flattener". So omit this test and test select6-8.6 in that case.
 test:do_test(
     "select6-8.3",
@@ -740,7 +740,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select6-8.5",
     [[
-        SELECT * FROM 
+        SELECT * FROM
           (SELECT y, p, q, r FROM
              (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m,
              (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n
@@ -757,7 +757,7 @@ test:do_test(
     "select6-8.6",
     function()
         return is_flat([[
-    SELECT * FROM 
+    SELECT * FROM
       (SELECT y, p, q, r FROM
          (SELECT t1.y AS y, t2.b AS b FROM t1, t2 WHERE t1.x=t2.a) AS m,
          (SELECT t3.p AS p, t3.q AS q, t4.r AS r FROM t3 NATURAL JOIN t4) as n
@@ -889,7 +889,7 @@ test:do_execsql_test(
 
 ---------------------------------------------------------------------------
 -- Test that if a UNION ALL sub-query that would otherwise be eligible for
--- flattening consists of two or more SELECT statements that do not all 
+-- flattening consists of two or more SELECT statements that do not all
 -- return the same number of result columns, the error is detected.
 --
 test:do_execsql_test(
@@ -938,7 +938,7 @@ test:do_catchsql_test(
     10.7,
     [[
         SELECT * FROM (
-          SELECT * FROM t UNION ALL 
+          SELECT * FROM t UNION ALL
           SELECT l,m,l FROM j UNION ALL
           SELECT * FROM k
         )
@@ -949,14 +949,14 @@ test:do_catchsql_test(
     [[
         SELECT * FROM (
           SELECT * FROM k UNION ALL
-          SELECT * FROM t UNION ALL 
-          SELECT l,m,l FROM j 
+          SELECT * FROM t UNION ALL
+          SELECT l,m,l FROM j
         )
     ]], err)
 
 -- 2015-02-09 Ticket [2f7170d73bf9abf80339187aa3677dce3dbcd5ca]
 -- "misuse of aggregate" error if aggregate column from FROM
--- subquery is used in correlated subquery 
+-- subquery is used in correlated subquery
 --
 test:do_execsql_test(
     11.1,
@@ -1023,7 +1023,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     11.5,
     [[
-        SELECT cnt, xyz, 
+        SELECT cnt, xyz,
                CASE WHEN (SELECT y FROM t2 WHERE w=cnt)=='two'
                     THEN 'aaa' ELSE 'bbb'
                 END, '|'
diff --git a/test/sql-tap/select7.test.lua b/test/sql-tap/select7.test.lua
index 7ff1f76d5..6b8f385e9 100755
--- a/test/sql-tap/select7.test.lua
+++ b/test/sql-tap/select7.test.lua
@@ -192,7 +192,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(56.0);
     ]], {
         -- <select7-7.1>
-        
+
         -- </select7-7.1>
     })
 
@@ -215,7 +215,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES( 3.0 );
     ]], {
         -- <select7-7.3>
-        
+
         -- </select7-7.3>
     })
 
@@ -232,7 +232,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select7-7.5",
     [[
-        SELECT a=0, typeof(a) FROM t4 
+        SELECT a=0, typeof(a) FROM t4
     ]], {
         -- <select7-7.5>
         false, "number", false, "number"
@@ -242,7 +242,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "select7-7.6",
     [[
-        SELECT a=0, typeof(a) FROM t4 GROUP BY a 
+        SELECT a=0, typeof(a) FROM t4 GROUP BY a
     ]], {
         -- <select7-7.6>
         false, "number", false, "number"
diff --git a/test/sql-tap/select8.test.lua b/test/sql-tap/select8.test.lua
index c1bdd93a2..747dd9bca 100755
--- a/test/sql-tap/select8.test.lua
+++ b/test/sql-tap/select8.test.lua
@@ -32,9 +32,9 @@ test:execsql [[
     INSERT INTO songs VALUES(6,'two',11);
 ]]
 local result = test:execsql [[
-    SELECT DISTINCT artist,sum(timesplayed) AS total      
-    FROM songs      
-    GROUP BY LOWER(artist)      
+    SELECT DISTINCT artist,sum(timesplayed) AS total
+    FROM songs
+    GROUP BY LOWER(artist)
 ]]
 
 local function subrange(t, first, last)
@@ -48,27 +48,27 @@ end
 test:do_execsql_test(
     "select8-1.1",
     [[
-        SELECT DISTINCT artist,sum(timesplayed) AS total      
-        FROM songs      
-        GROUP BY LOWER(artist)      
+        SELECT DISTINCT artist,sum(timesplayed) AS total
+        FROM songs
+        GROUP BY LOWER(artist)
         LIMIT 1 OFFSET 1
     ]], subrange(result, 3, 4))
 
 test:do_execsql_test(
     "select8-1.2",
     [[
-        SELECT DISTINCT artist,sum(timesplayed) AS total      
-        FROM songs      
-        GROUP BY LOWER(artist)      
+        SELECT DISTINCT artist,sum(timesplayed) AS total
+        FROM songs
+        GROUP BY LOWER(artist)
         LIMIT 2 OFFSET 1
     ]], subrange(result, 3, 6))
 
 test:do_execsql_test(
     "select8-1.3",
     [[
-        SELECT DISTINCT artist,sum(timesplayed) AS total      
-        FROM songs      
-        GROUP BY LOWER(artist)      
+        SELECT DISTINCT artist,sum(timesplayed) AS total
+        FROM songs
+        GROUP BY LOWER(artist)
         LIMIT 1000 OFFSET 2
     ]], subrange(result, 5, #result))
 
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 769f70069..ec09f2cd8 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -18,7 +18,7 @@ test.silent = true
 -- This file implements regression tests for sql library.
 --
 -- $Id: select9.test,v 1.4 2008/07/01 14:39:35 danielk1977 Exp $
--- The tests in this file are focused on test compound SELECT statements 
+-- The tests in this file are focused on test compound SELECT statements
 -- that have any or all of an ORDER BY, LIMIT or OFFSET clauses. As of
 -- version 3.6.0, sql contains code to use SQL indexes where possible
 -- to optimize such statements.
@@ -31,18 +31,18 @@ test.silent = true
 ---------------------------------------------------------------------------
 -- test_compound_select TESTNAME SELECT RESULT
 --
---   This command is used to run multiple LIMIT/OFFSET test cases based on 
+--   This command is used to run multiple LIMIT/OFFSET test cases based on
 --   the single SELECT statement passed as the second argument. The SELECT
 --   statement may not contain a LIMIT or OFFSET clause. This proc tests
 --   many statements of the form:
---    
+--
 --     "$SELECT limit $X offset $Y"
---    
+--
 --   for various values of $X and $Y.
---    
+--
 --   The third argument, $RESULT, should contain the expected result of
 --   the command [execsql $SELECT].
---    
+--
 --   The first argument, $TESTNAME, is used as the base test case name to
 --   pass to [do_test] for each individual LIMIT OFFSET test case.
 --
@@ -164,13 +164,13 @@ test:do_execsql_test(
         COMMIT;
     ]], {
         -- <select9-1.0>
-        
+
         -- </select9-1.0>
     })
 
 -- Each iteration of this loop runs the same tests with a different set
 -- of indexes present within the database schema. The data returned by
--- the compound SELECT statements in the test cases should be the same 
+-- the compound SELECT statements in the test cases should be the same
 -- in each case.
 --
 local iOuterLoop = 1
@@ -269,7 +269,7 @@ test:do_execsql_test(
         DROP INDEX i4 ON t2;
     ]], {
         -- <select9-2.0>
-        
+
         -- </select9-2.0>
     })
 
@@ -281,7 +281,7 @@ local _ = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
 --end
 
 --db("collate", "reverse", "reverse")
--- This loop is similar to the previous one (test cases select9-1.*) 
+-- This loop is similar to the previous one (test cases select9-1.*)
 -- except that the simple select statements have WHERE clauses attached
 -- to them. Sometimes the WHERE clause may be satisfied using the same
 -- index used for ORDER BY, sometimes not.
@@ -305,7 +305,7 @@ for _, indexes in ipairs({ [[
     test:do_execsql_test(
 "select9-2."..iOuterLoop..".1",
 indexes, {
-            
+
         })
 
     test_compound_select_flippable("select9-2."..iOuterLoop..".2", [[
@@ -346,7 +346,7 @@ test:do_execsql_test(
         DROP INDEX i3 ON t1;
     ]], {
         -- <select9-2.X>
-        
+
         -- </select9-2.X>
     })
 
@@ -371,7 +371,7 @@ test:do_execsql_test(
 --     SELECT t1.a FROM t1 UNION ALL SELECT t2.d FROM t2 ORDER BY 1
 --
 -- can use indexes to run without doing a in-memory sort operation.
--- This block of tests (select9-3.*) is used to check if the same 
+-- This block of tests (select9-3.*) is used to check if the same
 -- is possible with:
 --
 --     CREATE VIEW v1 AS SELECT a FROM t1 UNION ALL SELECT d FROM t2
@@ -524,7 +524,7 @@ test:do_test(
     })
 
 -- Full table scan if the "+x" prevents index usage.
--- 2013-07-09:  Ticket [490a4b7235624298]: 
+-- 2013-07-09:  Ticket [490a4b7235624298]:
 -- "WHERE 0" on the first element of a UNION causes an assertion fault
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index f1f43af76..88f108f57 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -73,7 +73,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(2, 21, 24, 27);
     ]], {
         -- <selectB-1.1>
-        
+
         -- </selectB-1.1>
     })
 
@@ -86,7 +86,7 @@ for ii = 1, 2, 1 do
                 CREATE INDEX i2 ON t2(d);
             ]], {
                 -- <selectB-2.1>
-                
+
                 -- </selectB-2.1>
             })
 
@@ -102,40 +102,40 @@ for ii = 1, 2, 1 do
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1
   ]], { 2.0, 3.0, 8.0, 12.0, 14.0, 21.0})
     test_transform("selectB-"..ii..".4", [[
-    SELECT * FROM 
-      (SELECT a FROM t1 UNION ALL SELECT d FROM t2) 
+    SELECT * FROM
+      (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
     WHERE a>10 ORDER BY 1
   ]], [[
     SELECT a FROM t1 WHERE a>10 UNION ALL SELECT d FROM t2 WHERE d>10 ORDER BY 1
   ]], { 12.0, 14.0, 21.0})
     test_transform("selectB-"..ii..".5", [[
-    SELECT * FROM 
-      (SELECT a FROM t1 UNION ALL SELECT d FROM t2) 
+    SELECT * FROM
+      (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
     WHERE a>10 ORDER BY a
   ]], [[
-    SELECT a FROM t1 WHERE a>10 
-      UNION ALL 
-    SELECT d FROM t2 WHERE d>10 
+    SELECT a FROM t1 WHERE a>10
+      UNION ALL
+    SELECT d FROM t2 WHERE d>10
     ORDER BY a
   ]], { 12.0, 14.0, 21.0})
     test_transform("selectB-"..ii..".6", [[
-    SELECT * FROM 
-      (SELECT a FROM t1 UNION ALL SELECT d FROM t2 WHERE d > 12) 
+    SELECT * FROM
+      (SELECT a FROM t1 UNION ALL SELECT d FROM t2 WHERE d > 12)
     WHERE a>10 ORDER BY a
   ]], [[
     SELECT a FROM t1 WHERE a>10
-      UNION ALL 
+      UNION ALL
     SELECT d FROM t2 WHERE d>12 AND d>10
     ORDER BY a
   ]], { 14.0, 21.0})
     test_transform("selectB-"..ii..".7", [[
-    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1 
+    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1
     LIMIT 2
   ]], [[
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 LIMIT 2
   ]], { 2.0, 3.0})
     test_transform("selectB-"..ii..".8", [[
-    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1 
+    SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2) ORDER BY 1
     LIMIT 2 OFFSET 3
   ]], [[
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 LIMIT 2 OFFSET 3
@@ -143,7 +143,7 @@ for ii = 1, 2, 1 do
     test_transform("selectB-"..ii..".9", [[
     SELECT * FROM (
       SELECT a FROM t1 UNION ALL SELECT d FROM t2 UNION ALL SELECT c FROM t1
-    ) 
+    )
   ]], [[
     SELECT a FROM t1 UNION ALL SELECT d FROM t2 UNION ALL SELECT c FROM t1
   ]], { 2.0, 8.0, 14.0, 3.0, 12.0, 21.0, 6.0, 12.0, 18.0})
@@ -206,7 +206,7 @@ test:do_execsql_test(
         DROP INDEX i2 ON t2;
     ]], {
         -- <selectB-3.0>
-        
+
         -- </selectB-3.0>
     })
 
@@ -228,7 +228,7 @@ for ii = 3, 6, 1 do
                 CREATE INDEX i6 ON t2(f);
             ]], {
                 -- <selectB-5.0>
-                
+
                 -- </selectB-5.0>
             })
 
@@ -239,8 +239,8 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".1",
         [[
-            SELECT DISTINCT * FROM 
-              (SELECT c FROM t1 UNION ALL SELECT e FROM t2) 
+            SELECT DISTINCT * FROM
+              (SELECT c FROM t1 UNION ALL SELECT e FROM t2)
             ORDER BY 1;
         ]], {
             6, 12, 15, 18, 24
@@ -249,8 +249,8 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".2",
         [[
-            SELECT c, count(*) FROM 
-              (SELECT c FROM t1 UNION ALL SELECT e FROM t2) 
+            SELECT c, count(*) FROM
+              (SELECT c FROM t1 UNION ALL SELECT e FROM t2)
             GROUP BY c ORDER BY 1;
         ]], {
             6, 2, 12, 1, 15, 1, 18, 1, 24, 1
@@ -259,8 +259,8 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".3",
         [[
-            SELECT c, count(*) FROM 
-              (SELECT c FROM t1 UNION ALL SELECT e FROM t2) 
+            SELECT c, count(*) FROM
+              (SELECT c FROM t1 UNION ALL SELECT e FROM t2)
             GROUP BY c HAVING count(*)>1;
         ]], {
             6, 2
@@ -269,7 +269,7 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".4",
         [[
-            SELECT t4.c, t3.a FROM 
+            SELECT t4.c, t3.a FROM
               (SELECT c FROM t1 UNION ALL SELECT e FROM t2) AS t4, t1 AS t3
             WHERE t3.a=14
             ORDER BY 1
@@ -280,28 +280,28 @@ for ii = 3, 6, 1 do
     test:do_execsql_test(
         "selectB-"..ii..".5",
         [[
-            SELECT d FROM t2 
-            EXCEPT 
+            SELECT d FROM t2
+            EXCEPT
             SELECT a FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
         ]], {
-            
+
         })
 
     test:do_execsql_test(
         "selectB-"..ii..".6",
         [[
             SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
-            EXCEPT 
+            EXCEPT
             SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2)
         ]], {
-            
+
         })
 
     test:do_execsql_test(
         "selectB-"..ii..".7",
         [[
             SELECT c FROM t1
-            EXCEPT 
+            EXCEPT
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
         ]], {
             12
@@ -311,7 +311,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".8",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            EXCEPT 
+            EXCEPT
             SELECT c FROM t1
         ]], {
             9, 15, 24, 27
@@ -321,7 +321,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".9",
         [[
             SELECT c FROM t1
-            UNION 
+            UNION
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY c
         ]], {
@@ -341,7 +341,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".11",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            UNION 
+            UNION
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY 1
         ]], {
@@ -352,7 +352,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".12",
         [[
             SELECT c FROM t1
-            INTERSECT 
+            INTERSECT
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY 1
         ]], {
@@ -363,7 +363,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".13",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            INTERSECT 
+            INTERSECT
             SELECT c FROM t1
             ORDER BY 1
         ]], {
@@ -374,7 +374,7 @@ for ii = 3, 6, 1 do
         "selectB-"..ii..".14",
         [[
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
-            INTERSECT 
+            INTERSECT
             SELECT * FROM (SELECT e FROM t2 UNION ALL SELECT f FROM t2)
             ORDER BY 1
         ]], {
diff --git a/test/sql-tap/selectC.test.lua b/test/sql-tap/selectC.test.lua
index 20a0203a6..5c66b187d 100755
--- a/test/sql-tap/selectC.test.lua
+++ b/test/sql-tap/selectC.test.lua
@@ -288,10 +288,10 @@ test:do_execsql_test(
 --     INSERT INTO person VALUES('lakeside', 'amy', NULL);
 --     INSERT INTO person VALUES('lake-apts', 'tom', NULL);
 --     INSERT INTO person VALUES('acorn', 'hideo', 'CQB421');
---     SELECT 
---       org_id, 
+--     SELECT
+--       org_id,
 --       count((NOT (org_id IS NULL)) AND (NOT (nickname IS NULL)))
---     FROM person 
+--     FROM person
 --     WHERE (CASE WHEN license != '' THEN 1 ELSE 0 END)
 --     GROUP BY 1;
 --   }
diff --git a/test/sql-tap/selectE.test.lua b/test/sql-tap/selectE.test.lua
index fb1bc8794..83582d0e2 100755
--- a/test/sql-tap/selectE.test.lua
+++ b/test/sql-tap/selectE.test.lua
@@ -16,7 +16,7 @@ test:plan(7)
 -- This file implements regression tests for compound SELECT statements
 -- that have ORDER BY clauses with collating sequences that differ
 -- from the collating sequence used for comparison in the compound.
--- 
+--
 -- Ticket 6709574d2a8d8b9be3a9cb1afbf4ff2de48ea4e7:
 -- drh added on 2013-05-06 15:21:16:
 --
@@ -27,22 +27,22 @@ test:plan(7)
 -- operator. Note that the ".print" commands are instructions to the
 -- sql.exe shell program to output delimiter lines so that you can more
 -- easily tell where the output of one query ends and the next query
--- begins. 
--- 
+-- begins.
+--
 --     CREATE TABLE t1(a TEXT);
 --     INSERT INTO t1 VALUES('abc'),('def');
 --     CREATE TABLE t2(a TEXT);
 --     INSERT INTO t2 VALUES('DEF');
--- 
+--
 --     SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a;
 --     .print -----
 --     SELECT a FROM (SELECT a FROM t1 EXCEPT SELECT a FROM t2)
 --      ORDER BY a COLLATE nocase;
 --     .print -----
 --     SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a COLLATE nocase;
--- 
+--
 -- Bisecting shows that this problem was introduced in sql version 3.6.0
--- by check-in [8bbfa97837a74ef] on 2008-06-15. 
+-- by check-in [8bbfa97837a74ef] on 2008-06-15.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -118,7 +118,7 @@ test:do_test(
         ]]
     end, {
         -- <selectE-2.1>
-        
+
         -- </selectE-2.1>
     })
 
@@ -131,7 +131,7 @@ test:do_test(
         ]]
     end, {
         -- <selectE-2.2>
-        
+
         -- </selectE-2.2>
     })
 
diff --git a/test/sql-tap/selectF.test.lua b/test/sql-tap/selectF.test.lua
index 2a86a4da8..fc21d1591 100755
--- a/test/sql-tap/selectF.test.lua
+++ b/test/sql-tap/selectF.test.lua
@@ -36,16 +36,16 @@ test:do_execsql_test(
 
 --explain_i {
 --  SELECT * FROM t2
---  UNION ALL 
---  SELECT * FROM t1 WHERE a<5 
+--  UNION ALL
+--  SELECT * FROM t1 WHERE a<5
 --  ORDER BY 2, 1
 --}
 test:do_execsql_test(
     2,
     [[
         SELECT * FROM t2
-        UNION ALL 
-        SELECT * FROM t1 WHERE a<5 
+        UNION ALL
+        SELECT * FROM t1 WHERE a<5
         ORDER BY 2, 1
     ]], {
         -- <2>
diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
index 2f92da96c..c85c222b6 100755
--- a/test/sql-tap/subquery.test.lua
+++ b/test/sql-tap/subquery.test.lua
@@ -137,7 +137,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "subquery-1.9.2",
     [[
-        SELECT a FROM t1 WHERE (SELECT (y*2)>b FROM t2 WHERE a=x); 
+        SELECT a FROM t1 WHERE (SELECT (y*2)>b FROM t2 WHERE a=x);
     ]], {
         -- <subquery-1.9.2>
         3, 5, 7
@@ -191,7 +191,7 @@ test:do_execsql_test(
         INSERT INTO t5 VALUES(5, '2003-4');
 
         SELECT period, vsum
-        FROM (SELECT 
+        FROM (SELECT
           a.period,
           (select sum(val) from t5 where period between a.period and '2002-4') vsum
           FROM t5 a where a.period between '2002-1' and '2002-4')
@@ -208,7 +208,7 @@ test:do_execsql_test(
         SELECT period, vsum from
           (select a.period,
           (select sum(val) from t5 where period between a.period and '2002-4') vsum
-        FROM t5 a where a.period between '2002-1' and '2002-4') 
+        FROM t5 a where a.period between '2002-1' and '2002-4')
         WHERE vsum < 45 ;
     ]], {
         -- <subquery-1.10.5>
@@ -222,7 +222,7 @@ test:do_execsql_test(
         DROP TABLE t5;
     ]], {
         -- <subquery-1.10.6>
-        
+
         -- </subquery-1.10.6>
     })
 
@@ -249,7 +249,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(3, 1);
     ]], {
         -- <subquery-2.2.1>
-        
+
         -- </subquery-2.2.1>
     })
 
@@ -269,7 +269,7 @@ test:do_execsql_test(
         DROP TABLE t3;
     ]], {
         -- <subquery-2.2.3>
-        
+
         -- </subquery-2.2.3>
     })
 
@@ -280,7 +280,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES('10');
     ]], {
         -- <subquery-2.3.1>
-        
+
         -- </subquery-2.3.1>
     })
 
@@ -300,7 +300,7 @@ test:do_execsql_test(
         DROP TABLE t3;
     ]], {
         -- <subquery-2.3.3>
-        
+
         -- </subquery-2.3.3>
     })
 
@@ -311,7 +311,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES('XX');
     ]], {
         -- <subquery-2.4.1>
-        
+
         -- </subquery-2.4.1>
     })
 
@@ -331,7 +331,7 @@ test:do_execsql_test(
         DROP TABLE t3;
     ]], {
         -- <subquery-2.4.3>
-        
+
         -- </subquery-2.4.3>
     })
 
@@ -582,8 +582,8 @@ test:do_execsql_test(
     })
 
 --------------------------------------------------------------------
--- These tests - subquery-4.* - use the TCL statement cache to try 
--- and expose bugs to do with re-using statements that have been 
+-- These tests - subquery-4.* - use the TCL statement cache to try
+-- and expose bugs to do with re-using statements that have been
 -- passed to sql_reset().
 --
 -- One problem was that VDBE memory cells were not being initialized
@@ -620,7 +620,7 @@ test:do_test(
         return test:execsql "INSERT INTO t3 VALUES((SELECT max(a) FROM t3)+1)"
     end, {
         -- <subquery-4.2.1>
-        
+
         -- </subquery-4.2.1>
     })
 
@@ -630,7 +630,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES((SELECT max(a) FROM t3)+1)
     ]], {
         -- <subquery-4.2.2>
-        
+
         -- </subquery-4.2.2>
     })
 
@@ -862,7 +862,7 @@ test:do_execsql_test(
         SELECT (SELECT 0 FROM (SELECT * FROM (SELECT 0))) AS x WHERE x <> 0;
     ]], {
         -- <subquery-8.1>
-        
+
         -- </subquery-8.1>
     })
 
diff --git a/test/sql-tap/subquery2.test.lua b/test/sql-tap/subquery2.test.lua
index 92fe33d04..a499515b5 100755
--- a/test/sql-tap/subquery2.test.lua
+++ b/test/sql-tap/subquery2.test.lua
@@ -90,7 +90,7 @@ test:do_execsql_test(
     "subquery2-1.21",
     [[
         SELECT a FROM t1
-         WHERE +b=(SELECT x+1 FROM 
+         WHERE +b=(SELECT x+1 FROM
                      (SELECT DISTINCT f/d AS x FROM t2 JOIN t3 ON d*a=f))
     ]], {
         -- <subquery2-1.21>
@@ -102,7 +102,7 @@ test:do_execsql_test(
     "subquery2-1.22",
     [[
         SELECT a FROM t1
-         WHERE b=(SELECT x+1 FROM 
+         WHERE b=(SELECT x+1 FROM
                      (SELECT DISTINCT f/d AS x FROM t2 JOIN t3 ON d*a=f))
     ]], {
         -- <subquery2-1.22>
@@ -129,7 +129,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     2.2,
     [[
-        SELECT * 
+        SELECT *
         FROM (SELECT * FROM t4 ORDER BY a LIMIT 1000000 OFFSET 1)
         LIMIT (SELECT a FROM t5)
     ]], {
@@ -140,7 +140,7 @@ test:do_execsql_test(
 
 -----------------------------------------------------------------------------
 -- Ticket http://www.sql.org/src/info/d11a6e908f (2014-09-20)
--- Query planner fault on three-way nested join with compound inner SELECT 
+-- Query planner fault on three-way nested join with compound inner SELECT
 --
 test:do_execsql_test(
     3.0,
diff --git a/test/sql-tap/subselect.test.lua b/test/sql-tap/subselect.test.lua
index b6a20948d..f8ba3fb9e 100755
--- a/test/sql-tap/subselect.test.lua
+++ b/test/sql-tap/subselect.test.lua
@@ -91,7 +91,7 @@ test:do_execsql_test(
         SELECT b from t1 where a = (SELECT a FROM t1 WHERE b=8)
     ]], {
         -- <subselect-1.3d>
-        
+
         -- </subselect-1.3d>
     })
 
@@ -134,7 +134,7 @@ test:do_test(
             INSERT INTO t2 VALUES(4,16);
         ]]
         return test:execsql [[
-            SELECT y from t2 
+            SELECT y from t2
             WHERE x = (SELECT sum(b) FROM t1 where a is not null) - (SELECT sum(a) FROM t1)
         ]]
     end, {
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index bb36d994e..7e9b08cdb 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -29,7 +29,7 @@ test:do_execsql_test(
         )
     ]], {
         -- <table-1.1>
-        
+
         -- </table-1.1>
     })
 
@@ -62,7 +62,7 @@ test:do_test(
         --execsql {SELECT * FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-1.5>
-        
+
         -- </table-1.5>
     })
 
@@ -83,7 +83,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-1.10>
-        
+
         -- </table-1.10>
     })
 
@@ -95,7 +95,7 @@ test:do_test(
         --execsql {SELECT name FROM "sql_master" WHERE type!='meta'}
     end, {
         -- <table-1.11>
-        
+
         -- </table-1.11>
     })
 
@@ -106,7 +106,7 @@ test:do_test(
         --execsql {SELECT name as "X" FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-1.12>
-        
+
         -- </table-1.12>
     })
 
@@ -118,7 +118,7 @@ test:do_test(
         --execsql {SELECT name FROM "sql_master" WHERE type!='meta'}
     end, {
         -- <table-1.13>
-        
+
         -- </table-1.13>
     })
 
@@ -171,7 +171,7 @@ test:do_execsql_test(
         DROP TABLE test2; --SELECT name FROM sql_master WHERE type!='meta'
     ]], {
         -- <table-2.1f>
-        
+
         -- </table-2.1f>
     })
 
@@ -185,7 +185,7 @@ test:do_test(
         --catchsql {CREATE TABLE test3(id primary key, two text)}
     end, {
         -- <table-2.2a>
-        
+
         -- </table-2.2a>
     })
 
@@ -220,7 +220,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta' ORDER BY name}
     end, {
         -- <table-2.2f>
-        
+
         -- </table-2.2f>
     })
 
@@ -255,7 +255,7 @@ test:do_test(
         --execsql {SELECT sql FROM sql_master WHERE type=='table'}
     end, {
         -- <table-3.1>
-        
+
         -- </table-3.1>
     })
 
@@ -303,7 +303,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-3.6>
-        
+
         -- </table-3.6>
     })
 
@@ -365,7 +365,7 @@ test:do_test(
         return test:execsql [[SELECT "name" FROM "_space" WHERE "id">500]]
     end, {
         -- <table-4.3>
-        
+
         -- </table-4.3>
     })
 
@@ -436,7 +436,7 @@ if is_gh_5742_closed
             ]]
         end, {
             -- <table-5.2.2>
-            
+
             -- </table-5.2.2>
         })
 
@@ -453,7 +453,7 @@ test:do_test(
         --execsql {SELECT name FROM sql_master WHERE type!='meta'}
     end, {
         -- <table-5.3>
-        
+
         -- </table-5.3>
     })
 
@@ -482,7 +482,7 @@ test:do_test(
 --  set list [glob -nocomplain testdb/spaces*.tbl]
 --} {testdb/spaces+in+this+name+.tbl}
 -- Try using keywords as table names or column names.
--- 
+--
 test:do_catchsql_test(
     "table-7.1",
     [=[
@@ -959,7 +959,7 @@ test:do_execsql_test(
         SELECT * FROM tablet8;
     ]], {
         -- <table-13.1>
-        
+
         -- </table-13.1>
     })
 end
@@ -1008,7 +1008,7 @@ test:do_test(
     })
 end
 -- ifcapable attach {
---   # Now attach a database and ensure that a table can be created in the 
+--   # Now attach a database and ensure that a table can be created in the
 --   # attached database whilst in a callback from a query on the main database.
 --   do_test table-14.3 {
 --     forcedelete test2.db
@@ -1020,7 +1020,7 @@ end
 --       db eval {CREATE TABLE aux.t1(a, b, c)}
 --     }
 --   } {}
---   # On the other hand, it should be impossible to drop a table when any VMs 
+--   # On the other hand, it should be impossible to drop a table when any VMs
 --   # are active. This is because VerifyCookie instructions may have already
 --   # been executed, and btree root-pages may not move after this (which a
 --   # delete table might do).
@@ -1031,7 +1031,7 @@ end
 --           db eval {DROP TABLE aux.t1;}
 --         }
 --       } msg
---     ] 
+--     ]
 --     set result [list $rc $msg]
 --   } {1 {database table is locked}}
 -- }
@@ -1051,7 +1051,7 @@ test:do_test(
         return
     end, {
         -- <table-15.1>
-        
+
         -- </table-15.1>
     })
 
@@ -1066,7 +1066,7 @@ test:do_test(
         return
     end, {
         -- <table-15.2>
-        
+
         -- </table-15.2>
     })
 
diff --git a/test/sql-tap/tkt-02a8e81d44.test.lua b/test/sql-tap/tkt-02a8e81d44.test.lua
index 1ab0e175c..9b95a9d79 100755
--- a/test/sql-tap/tkt-02a8e81d44.test.lua
+++ b/test/sql-tap/tkt-02a8e81d44.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [02a8e81d44] has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt-31338dca7e.test.lua b/test/sql-tap/tkt-31338dca7e.test.lua
index 6f11b0eb5..41dbc4520 100755
--- a/test/sql-tap/tkt-31338dca7e.test.lua
+++ b/test/sql-tap/tkt-31338dca7e.test.lua
@@ -202,7 +202,7 @@ if (1 > 0)
                 CREATE TABLE t5(a  INT primary key,b INT ,c INT ,d INT ,e INT ,f INT );
                 CREATE TABLE t6(g  INT primary key,h INT );
                 CREATE TRIGGER t6r AFTER INSERT ON t6 FOR EACH ROW BEGIN
-                  INSERT INTO t5    
+                  INSERT INTO t5
                     SELECT * FROM t3 LEFT JOIN t1 ON d=g LEFT JOIN t4 ON c=h
                      WHERE (a=1 AND h=4)
                         OR (b IN (
diff --git a/test/sql-tap/tkt-385a5b56b9.test.lua b/test/sql-tap/tkt-385a5b56b9.test.lua
index fe314e802..3a1d66cf3 100755
--- a/test/sql-tap/tkt-385a5b56b9.test.lua
+++ b/test/sql-tap/tkt-385a5b56b9.test.lua
@@ -29,7 +29,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "1.1",
     [[
-        SELECT DISTINCT x, y FROM t1 
+        SELECT DISTINCT x, y FROM t1
     ]], {
         -- <1.1>
         1, "", 2, ""
@@ -45,7 +45,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "1.3",
     [[
-        SELECT DISTINCT x, y FROM t1 
+        SELECT DISTINCT x, y FROM t1
     ]], {
         -- <1.3>
         1, "", 2, ""
diff --git a/test/sql-tap/tkt-3a77c9714e.test.lua b/test/sql-tap/tkt-3a77c9714e.test.lua
index b529d32bc..43ff8781c 100755
--- a/test/sql-tap/tkt-3a77c9714e.test.lua
+++ b/test/sql-tap/tkt-3a77c9714e.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [3a77c9714e] has been
--- fixed.  
+-- fixed.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 
@@ -66,9 +66,9 @@ test:do_execsql_test(
     [[
         SELECT
           SrcWord, Beginnings.Title
-          FROM 
+          FROM
             (SELECT 'FACTORING' AS SrcWord UNION SELECT 'SWIMMING' AS SrcWord )
-          LEFT JOIN 
+          LEFT JOIN
             Beginnings
           WHERE Beginnings.Id= (
             SELECT BeginningId FROM (
diff --git a/test/sql-tap/tkt-4a03edc4c8.test.lua b/test/sql-tap/tkt-4a03edc4c8.test.lua
index 1bbaed30b..badc67e71 100755
--- a/test/sql-tap/tkt-4a03edc4c8.test.lua
+++ b/test/sql-tap/tkt-4a03edc4c8.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that
--- ticket [4a03edc4c8c028c93e9269f64fc5e97f632c1166] has been fixed.  
+-- ticket [4a03edc4c8c028c93e9269f64fc5e97f632c1166] has been fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt-4dd95f6943.test.lua b/test/sql-tap/tkt-4dd95f6943.test.lua
index 5f6077d2a..ff89cb4f8 100755
--- a/test/sql-tap/tkt-4dd95f6943.test.lua
+++ b/test/sql-tap/tkt-4dd95f6943.test.lua
@@ -139,7 +139,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.5", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x ASC, y ASC;
             ]], inexpr), {
                 4, 1, 2, 4, 1, 4, 4, 1, 5
@@ -148,7 +148,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.6", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x ASC, y ASC;
             ]], inexpr), {
                 2, 1, 2, 2, 1, 4, 2, 1, 5
@@ -157,7 +157,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.7", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x ASC, y DESC;
             ]], inexpr), {
                 4, 1, 5, 4, 1, 4, 4, 1, 2
@@ -166,7 +166,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             "2."..tn1..".8",
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x ASC, y DESC;
             ]], inexpr), {
                 2, 1, 5, 2, 1, 4, 2, 1, 2
@@ -175,7 +175,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.9", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x DESC, y ASC;
             ]], inexpr), {
                 4, 1, 2, 4, 1, 4, 4, 1, 5
@@ -184,7 +184,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             "2."..tn1..".10",
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x DESC, y ASC;
             ]], inexpr), {
                 2, 1, 2, 2, 1, 4, 2, 1, 5
@@ -193,7 +193,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.11", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 4 AND x = 1 AND y IN %s
                 ORDER BY a, x DESC, y DESC;
             ]], inexpr), {
                 4, 1, 5, 4, 1, 4, 4, 1, 2
@@ -202,7 +202,7 @@ for tn1, idx in ipairs(indexes) do
         test:do_execsql_test(
             string.format("2.%s.%s.12", tn1, tn2),
             string.format([[
-                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s 
+                SELECT a, x, y FROM t2, t3 WHERE a = 2 AND x = 1 AND y IN %s
                 ORDER BY x DESC, y DESC;
             ]], inexpr), {
                 2, 1, 5, 2, 1, 4, 2, 1, 2
diff --git a/test/sql-tap/tkt-54844eea3f.test.lua b/test/sql-tap/tkt-54844eea3f.test.lua
index bfb94507c..ae24d0a02 100755
--- a/test/sql-tap/tkt-54844eea3f.test.lua
+++ b/test/sql-tap/tkt-54844eea3f.test.lua
@@ -39,7 +39,7 @@ test:do_execsql_test(
         INSERT INTO t3 VALUES(3);
     ]], {
         -- <1.0>
-        
+
         -- </1.0>
     })
 
@@ -47,7 +47,7 @@ test:do_execsql_test(
     "1.1",
     [[
         SELECT 'test-2', t3.c, (
-              SELECT count(*) 
+              SELECT count(*)
               FROM t1 JOIN (SELECT DISTINCT t3.c AS p FROM t2) AS x ON t1.a=x.p
         )
         FROM t3;
@@ -65,7 +65,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES(2, 'a', '2', 'two');
         INSERT INTO t4 VALUES(3, 'b', '1', 'three');
         INSERT INTO t4 VALUES(4, 'b', '2', 'four');
-        SELECT ( 
+        SELECT (
           SELECT c FROM (
             SELECT a,b,c FROM t4 WHERE a=output.a ORDER BY b LIMIT 10 OFFSET 1
           ) WHERE b=output.b
diff --git a/test/sql-tap/tkt-752e1646fc.test.lua b/test/sql-tap/tkt-752e1646fc.test.lua
index a7c6978f8..924a4834f 100755
--- a/test/sql-tap/tkt-752e1646fc.test.lua
+++ b/test/sql-tap/tkt-752e1646fc.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [752e1646fc] has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -24,9 +24,9 @@ test:do_execsql_test(
     "tkt-752e1646fc-1.1",
     [[
         CREATE TABLE "test" ("letter" VARCHAR(1) PRIMARY KEY, "number" INTEGER NOT NULL);
-        INSERT INTO "test" ("letter", "number") VALUES('b', 1); 
-        INSERT INTO "test" ("letter", "number") VALUES('a', 2); 
-        INSERT INTO "test" ("letter", "number") VALUES('c', 2); 
+        INSERT INTO "test" ("letter", "number") VALUES('b', 1);
+        INSERT INTO "test" ("letter", "number") VALUES('a', 2);
+        INSERT INTO "test" ("letter", "number") VALUES('c', 2);
         SELECT DISTINCT "number" FROM (SELECT "letter", "number" FROM "test" ORDER BY "letter", "number" LIMIT 1) AS "test";
     ]], {
         -- <tkt-752e1646fc-1.1>
diff --git a/test/sql-tap/tkt-7bbfb7d442.test.lua b/test/sql-tap/tkt-7bbfb7d442.test.lua
index 1a748217d..448f884d8 100755
--- a/test/sql-tap/tkt-7bbfb7d442.test.lua
+++ b/test/sql-tap/tkt-7bbfb7d442.test.lua
@@ -16,7 +16,7 @@ test:plan(5)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket [7bbfb7d442] has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -40,7 +40,7 @@ if (1 > 0)
             CREATE TRIGGER t3t AFTER INSERT ON t3 FOR EACH ROW
             WHEN new.t3_d IS NULL BEGIN
               UPDATE t3 SET t3_d = (
-                SELECT d FROM 
+                SELECT d FROM
                   (SELECT * FROM t2 WHERE (new.t3_a%2)=(id%2) LIMIT 10),
                   (SELECT * FROM t1 WHERE (new.t3_a%2)=(id%2) LIMIT 10)
                 WHERE a = new.t3_a AND b = c
@@ -64,7 +64,7 @@ if (1 > 0)
     test:do_execsql_test(
         1.3,
         [[
-            DELETE FROM t3 
+            DELETE FROM t3
         ]])
 
     test:do_execsql_test(
@@ -81,7 +81,7 @@ if (1 > 0)
 
 
     ---------------------------------------------------------------------------
-    -- The following test case - 2.* - is from the original bug report as 
+    -- The following test case - 2.* - is from the original bug report as
     -- posted to the mailing list.
     --
     test:do_execsql_test(
@@ -97,8 +97,8 @@ if (1 > 0)
             );
 
             CREATE TRIGGER TGR_InventoryControl_AfterInsert
-            AFTER INSERT ON InventoryControl 
-            FOR EACH ROW WHEN NEW.ControlState=-1 BEGIN 
+            AFTER INSERT ON InventoryControl
+            FOR EACH ROW WHEN NEW.ControlState=-1 BEGIN
 
             INSERT OR REPLACE INTO InventoryControl(
                   InventoryControlId,SKU,Variant,ControlDate,ControlState,DeliveredQty
@@ -160,7 +160,7 @@ if (1 > 0)
             INSERT INTO TransactionDetail(TransactionId, SKU, Variant) VALUES(44, 31, 0);
 
 
-            INSERT INTO InventoryControl(SKU, Variant, ControlDate) SELECT 
+            INSERT INTO InventoryControl(SKU, Variant, ControlDate) SELECT
                 II.SKU AS SKU, II.Variant AS Variant, '2011-08-30' AS ControlDate
                 FROM InventoryItem II;
         ]])
diff --git a/test/sql-tap/tkt-80ba201079.test.lua b/test/sql-tap/tkt-80ba201079.test.lua
index 7b961aacd..30bdf5457 100755
--- a/test/sql-tap/tkt-80ba201079.test.lua
+++ b/test/sql-tap/tkt-80ba201079.test.lua
@@ -72,13 +72,13 @@ test:do_test(
 -- do_test tkt-80ba2-150 {
 --   optimization_control db factor-constants 1
 --   db cache flush
---   set x1 [db eval {EXPLAIN 
+--   set x1 [db eval {EXPLAIN
 --     SELECT * FROM t1, t2
 --      WHERE (a='A' AND b='X')
 --         OR (a='A' AND EXISTS (SELECT * FROM t3 WHERE c='C'));}]
 --   optimization_control db factor-constants 0
 --   db cache flush
---   set x2 [db eval {EXPLAIN 
+--   set x2 [db eval {EXPLAIN
 --     SELECT * FROM t1, t2
 --      WHERE (a='A' AND b='X')
 --         OR (a='A' AND EXISTS (SELECT * FROM t3 WHERE c='C'));}]
diff --git a/test/sql-tap/tkt-8c63ff0ec.test.lua b/test/sql-tap/tkt-8c63ff0ec.test.lua
index 3473b9105..703fd20f7 100755
--- a/test/sql-tap/tkt-8c63ff0ec.test.lua
+++ b/test/sql-tap/tkt-8c63ff0ec.test.lua
@@ -13,11 +13,11 @@ test:plan(3)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Test cases to show that ticket [8c63ff0eca81a9132d8d67b31cd6ae9712a2cc6f]
 -- "Incorrect query result on a UNION ALL" which was caused by using the same
 -- temporary register in concurrent co-routines, as been fixed.
--- 
+--
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
 test:do_execsql_test(
diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua
index dac546f10..f575e213f 100755
--- a/test/sql-tap/tkt-91e2e8ba6f.test.lua
+++ b/test/sql-tap/tkt-91e2e8ba6f.test.lua
@@ -12,7 +12,7 @@ test:plan(7)
 -------------------------------------------------------------------------
 --
 -- This file contains tests for sql. Specifically, it tests that sql
--- does not crash and an error is returned if localhost() fails. This 
+-- does not crash and an error is returned if localhost() fails. This
 -- is the problem reported by ticket 91e2e8ba6f.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -24,7 +24,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(11, 11);
     ]], {
         -- <1.1>
-        
+
         -- </1.1>
     })
 
@@ -71,7 +71,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.6,
     [[
-        SELECT a.x/10, a.y/10 FROM 
+        SELECT a.x/10, a.y/10 FROM
           (SELECT * FROM t1 LIMIT 5 OFFSET 0) AS a, t1 AS b WHERE a.x = b.x
         LIMIT 5 OFFSET 0;
     ]], {
diff --git a/test/sql-tap/tkt-a8a0d2996a.test.lua b/test/sql-tap/tkt-a8a0d2996a.test.lua
index 4878f8436..0dfa4653d 100755
--- a/test/sql-tap/tkt-a8a0d2996a.test.lua
+++ b/test/sql-tap/tkt-a8a0d2996a.test.lua
@@ -13,7 +13,7 @@ test:plan(12)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Tests to verify that arithmetic operators do not change the type of
 -- input operands.  Ticket [a8a0d2996a]
 --
diff --git a/test/sql-tap/tkt-ba7cbfaedc.test.lua b/test/sql-tap/tkt-ba7cbfaedc.test.lua
index 7ceda9270..ed12a8f5a 100755
--- a/test/sql-tap/tkt-ba7cbfaedc.test.lua
+++ b/test/sql-tap/tkt-ba7cbfaedc.test.lua
@@ -23,11 +23,11 @@ test:do_execsql_test(
     [[
         CREATE TABLE t1 (id  INT primary key, x INT , y TEXT);
         INSERT INTO t1 VALUES (1, 3, 'a');
-        INSERT INTO t1 VALUES (2, 1, 'a'); 
+        INSERT INTO t1 VALUES (2, 1, 'a');
         INSERT INTO t1 VALUES (3, 2, 'b');
         INSERT INTO t1 VALUES (4, 2, 'a');
         INSERT INTO t1 VALUES (5, 3, 'b');
-        INSERT INTO t1 VALUES (6, 1, 'b'); 
+        INSERT INTO t1 VALUES (6, 1, 'b');
     ]])
 
 test:do_execsql_test(
diff --git a/test/sql-tap/tkt-bd484a090c.test.lua b/test/sql-tap/tkt-bd484a090c.test.lua
index 6cd219722..29cb21fd2 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -13,7 +13,7 @@ test:plan(0)
 -------------------------------------------------------------------------
 --
 -- This file contains tests for sql. Specifically, it tests that sql
--- does not crash and an error is returned if localhost() fails. This 
+-- does not crash and an error is returned if localhost() fails. This
 -- is the problem reported by ticket bd484a090c.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/tkt-f973c7ac31.test.lua b/test/sql-tap/tkt-f973c7ac31.test.lua
index b44203e54..07fbc1fc1 100755
--- a/test/sql-tap/tkt-f973c7ac31.test.lua
+++ b/test/sql-tap/tkt-f973c7ac31.test.lua
@@ -25,7 +25,7 @@ test:do_execsql_test(
         INSERT INTO t VALUES(2, 5, 4);
     ]], {
         -- <tkt-f973c7ac3-1.0>
-        
+
         -- </tkt-f973c7ac3-1.0>
     })
 
@@ -46,7 +46,7 @@ for tn, sql in ipairs(sqls) do
     test:do_execsql_test(
         "tkt-f973c7ac3-1."..tn..".2",
         [[
-            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 DESC 
+            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 DESC
         ]], {
             5, 5, 5, 4
         })
@@ -85,7 +85,7 @@ for tn, sql in ipairs(sqls) do
     test:do_execsql_test(
         "tkt-f973c7ac3-1."..tn..".7",
         [[
-            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 ASC 
+            SELECT c1,c2 FROM t WHERE c1 = 5 AND c2>0 AND c2<=5 ORDER BY c2 ASC
         ]], {
             5, 4, 5, 5
         })
diff --git a/test/sql-tap/tkt-fa7bf5ec.test.lua b/test/sql-tap/tkt-fa7bf5ec.test.lua
index dbe168422..fd952db7d 100755
--- a/test/sql-tap/tkt-fa7bf5ec.test.lua
+++ b/test/sql-tap/tkt-fa7bf5ec.test.lua
@@ -20,9 +20,9 @@ test:plan(1)
 -- The problem described by this ticket was that the sqlExprCompare()
 -- function was saying that expressions (x='a') and (x='A') were identical
 -- because it was using sqlStrICmp() instead of strcmp() to compare string
--- literals.  That was causing the query optimizer for aggregate queries to 
--- believe that both count() operations were identical, and thus only 
--- computing the first count() and making a copy of the result for the 
+-- literals.  That was causing the query optimizer for aggregate queries to
+-- believe that both count() operations were identical, and thus only
+-- computing the first count() and making a copy of the result for the
 -- second count().
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/tkt1443.test.lua b/test/sql-tap/tkt1443.test.lua
index f40ca16d1..d0b56b082 100755
--- a/test/sql-tap/tkt1443.test.lua
+++ b/test/sql-tap/tkt1443.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1433 has been
--- fixed.  
+-- fixed.
 --
 -- The problem in ticket #1433 was that the dependencies on the right-hand
 -- side of an IN operator were not being checked correctly.  So in an
@@ -26,12 +26,12 @@ test:plan(3)
 --
 -- the optimizer was missing the fact that the right-hand side of the IN
 -- depended on table t2.  It was checking dependencies based on the
--- Expr.pRight field rather than Expr.pList and Expr.pSelect.  
+-- Expr.pRight field rather than Expr.pList and Expr.pSelect.
 --
 -- Such a bug could be verifed using a less elaborate test case.  But
 -- this test case (from the original bug poster) exercises so many different
 -- parts of the system all at once, that it seemed like a good one to
--- include in the test suite. 
+-- include in the test suite.
 --
 -- NOTE:  Yes, in spite of the name of this file (tkt1443.test) this
 -- test is for ticket #1433 not #1443.  I mistyped the name when I was
diff --git a/test/sql-tap/tkt1444.test.lua b/test/sql-tap/tkt1444.test.lua
index 837edcfbe..8496ae8ed 100755
--- a/test/sql-tap/tkt1444.test.lua
+++ b/test/sql-tap/tkt1444.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1444 has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1449.test.lua b/test/sql-tap/tkt1449.test.lua
index 3d402ba11..ef69b09ac 100755
--- a/test/sql-tap/tkt1449.test.lua
+++ b/test/sql-tap/tkt1449.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1449 has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1473.test.lua b/test/sql-tap/tkt1473.test.lua
index 070ac43a9..eda493afe 100755
--- a/test/sql-tap/tkt1473.test.lua
+++ b/test/sql-tap/tkt1473.test.lua
@@ -16,7 +16,7 @@ test:plan(57)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1473 has been
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -101,7 +101,7 @@ test:do_execsql_test(
         SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=0
     ]], {
         -- <tkt1473-1.8>
-        
+
         -- </tkt1473-1.8>
     })
 
@@ -111,7 +111,7 @@ test:do_execsql_test(
         SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=0
     ]], {
         -- <tkt1473-1.9>
-        
+
         -- </tkt1473-1.9>
     })
 
@@ -907,7 +907,7 @@ test:do_execsql_test(
         SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 2 FROM t2 WHERE y=2
     ]], {
         -- <tkt1473-8.1>
-        
+
         -- </tkt1473-8.1>
     })
 
diff --git a/test/sql-tap/tkt1501.test.lua b/test/sql-tap/tkt1501.test.lua
index 4b3e5de6e..37891d045 100755
--- a/test/sql-tap/tkt1501.test.lua
+++ b/test/sql-tap/tkt1501.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1501 is
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1514.test.lua b/test/sql-tap/tkt1514.test.lua
index 6cfc9676b..4ad745281 100755
--- a/test/sql-tap/tkt1514.test.lua
+++ b/test/sql-tap/tkt1514.test.lua
@@ -16,7 +16,7 @@ test:plan(1)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1514 is
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt1537.test.lua b/test/sql-tap/tkt1537.test.lua
index e333ce9fa..e4d4064b1 100755
--- a/test/sql-tap/tkt1537.test.lua
+++ b/test/sql-tap/tkt1537.test.lua
@@ -16,7 +16,7 @@ test:plan(15)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #1537 is
--- fixed.  
+-- fixed.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
diff --git a/test/sql-tap/tkt2141.test.lua b/test/sql-tap/tkt2141.test.lua
index f054d4502..eb3165144 100755
--- a/test/sql-tap/tkt2141.test.lua
+++ b/test/sql-tap/tkt2141.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #2141 has been
--- fixed.  
+-- fixed.
 --
 --
 -- $Id: tkt2141.test,v 1.2 2007/09/12 17:01:45 danielk1977 Exp $
diff --git a/test/sql-tap/tkt2192.test.lua b/test/sql-tap/tkt2192.test.lua
index 74ec19a63..365fddf15 100755
--- a/test/sql-tap/tkt2192.test.lua
+++ b/test/sql-tap/tkt2192.test.lua
@@ -17,7 +17,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #2192 has been
--- fixed.  
+-- fixed.
 --
 --
 -- $Id: tkt2192.test,v 1.3 2008/08/04 03:51:24 danielk1977 Exp $
@@ -92,7 +92,7 @@ test:do_execsql_test(
           select * from jan join nov on (jan.expense = nov.expense);
     ]], {
         -- <tkt2192-1.1>
-        
+
         -- </tkt2192-1.1>
     })
 
diff --git a/test/sql-tap/tkt2391.test.lua b/test/sql-tap/tkt2391.test.lua
index 1320d6490..3822adde5 100755
--- a/test/sql-tap/tkt2391.test.lua
+++ b/test/sql-tap/tkt2391.test.lua
@@ -26,7 +26,7 @@ test:do_execsql_test(
         INSERT INTO folders VALUES(4, 0, 'FolderC');
     ]], {
         -- <tkt2391.1>
-        
+
         -- </tkt2391.1>
     })
 
@@ -51,7 +51,7 @@ test:do_execsql_test(
     })
 
 -- This demonstrates the bug. Creating the index causes sql to ignore
--- the "COLLATE nocase" clause and use the default collation sequence 
+-- the "COLLATE nocase" clause and use the default collation sequence
 -- for column "foldername" instead (happens to be BINARY in this case).
 --
 test:do_execsql_test(
diff --git a/test/sql-tap/tkt2640.test.lua b/test/sql-tap/tkt2640.test.lua
index 5198eb183..4f0f2d1c3 100755
--- a/test/sql-tap/tkt2640.test.lua
+++ b/test/sql-tap/tkt2640.test.lua
@@ -18,7 +18,7 @@ test:plan(6)
 --
 -- $Id: tkt2640.test,v 1.3 2008/08/04 03:51:24 danielk1977 Exp $
 --
--- The problem in ticket #2640 was that the query optimizer was 
+-- The problem in ticket #2640 was that the query optimizer was
 -- not recognizing all uses of tables within subqueries in the
 -- WHERE clause.  If the subquery contained a compound SELECT,
 -- then tables that were used by terms of the compound other than
diff --git a/test/sql-tap/tkt2822.test.lua b/test/sql-tap/tkt2822.test.lua
index 3f67a0a74..602fed110 100755
--- a/test/sql-tap/tkt2822.test.lua
+++ b/test/sql-tap/tkt2822.test.lua
@@ -25,17 +25,17 @@ test:plan(30)
 
 
 -- The ORDER BY matching algorithm is three steps:
--- 
+--
 --   (1)  If the ORDER BY term is an integer constant i, then
 --        sort by the i-th column of the result set.
--- 
+--
 --   (2)  If the ORDER BY term is an identifier (not x.y or x.y.z
 --        but simply x) then look for a column alias with the same
 --        name.  If found, then sort by that column.
--- 
+--
 --   (3)  Evaluate the term as an expression and sort by the
 --        value of the expression.
--- 
+--
 -- For a compound SELECT the rules are modified slightly.
 -- In the third rule, the expression must exactly match one
 -- of the result columns.  The sequences of three rules is
@@ -51,7 +51,7 @@ test:plan(30)
 --
 -- Rule (2) was added by the changes ticket #2822.  Prior to
 -- that changes, sql did not support rule (2), making it
--- technically in violation of standard SQL semantics.  
+-- technically in violation of standard SQL semantics.
 -- No body noticed because rule (3) has the same effect as
 -- rule (2) except in some obscure cases.
 --
@@ -74,7 +74,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(6, 18, 54);
     ]], {
         -- <tkt2822-0.1>
-        
+
         -- </tkt2822-0.1>
     })
 
@@ -93,9 +93,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt2822-1.2",
     [[
-        SELECT a, CAST (b AS TEXT), c FROM t1 
-          UNION ALL 
-        SELECT a, b, c FROM t2 
+        SELECT a, CAST (b AS TEXT), c FROM t1
+          UNION ALL
+        SELECT a, b, c FROM t2
           ORDER BY 2;
     ]], {
         -- <tkt2822-1.2>
@@ -118,9 +118,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt2822-2.2",
     [[
-        SELECT a, CAST (b AS TEXT) AS x, c FROM t1 
-          UNION ALL 
-        SELECT a, b, c FROM t2 
+        SELECT a, CAST (b AS TEXT) AS x, c FROM t1
+          UNION ALL
+        SELECT a, b, c FROM t2
           ORDER BY x;
     ]], {
         -- <tkt2822-2.2>
@@ -143,9 +143,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt2822-3.1",
     [[
-        SELECT a, CAST (b AS TEXT) AS x, c FROM t1 
-          UNION ALL 
-        SELECT a, b, c FROM t2 
+        SELECT a, CAST (b AS TEXT) AS x, c FROM t1
+          UNION ALL
+        SELECT a, b, c FROM t2
           ORDER BY CAST (b AS TEXT);
     ]], {
         -- <tkt2822-3.1>
@@ -168,9 +168,9 @@ test:do_test(
     function()
         -- But the leftmost SELECT takes precedence.
         return test:execsql [[
-            SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1 
-              UNION ALL 
-            SELECT a, b, c FROM t2 
+            SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1
+              UNION ALL
+            SELECT a, b, c FROM t2
               ORDER BY a;
         ]]
     end, {
@@ -182,9 +182,9 @@ test:do_test(
 test:do_execsql_test(
     "tkt2822-3.5",
     [[
-        SELECT a, b, c FROM t2 
-          UNION ALL 
-        SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1 
+        SELECT a, b, c FROM t2
+          UNION ALL
+        SELECT a AS b, CAST (b AS TEXT) AS a, c FROM t1
           ORDER BY a;
     ]], {
         -- <tkt2822-3.5>
@@ -207,7 +207,7 @@ test:do_catchsql_test(
 -- Tests for rule (2).
 --
 -- The "ORDER BY b" should match the column alias (rule 2), not the
--- the t3.b value (rule 3).  
+-- the t3.b value (rule 3).
 --
 test:do_execsql_test(
     "tkt2822-5.1",
@@ -252,7 +252,7 @@ test:do_test(
 
 -- In "ORDER BY +b" the term is now an expression rather than
 -- a label.  It therefore matches by rule (3) instead of rule (2).
--- 
+--
 test:do_execsql_test(
     "tkt2822-5.5",
     [[
diff --git a/test/sql-tap/tkt2927.test.lua b/test/sql-tap/tkt2927.test.lua
index d51a228dd..acbb58a55 100755
--- a/test/sql-tap/tkt2927.test.lua
+++ b/test/sql-tap/tkt2927.test.lua
@@ -272,7 +272,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -287,7 +287,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -302,7 +302,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -317,7 +317,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -332,7 +332,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -347,7 +347,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -362,7 +362,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -377,7 +377,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT a, abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -392,7 +392,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -407,7 +407,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -422,7 +422,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -437,7 +437,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), b FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -452,7 +452,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, b FROM t1
             ORDER BY 1
         ]]
@@ -467,7 +467,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT a, abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -482,7 +482,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), b FROM t1
             ORDER BY 1
         ]]
@@ -497,7 +497,7 @@ test:do_test(
     function()
         return test:execsql [[
             SELECT abs(a), abs(b) FROM t1
-            UNION 
+            UNION
             SELECT abs(a), abs(b) FROM t1
             ORDER BY 1
         ]]
@@ -741,7 +741,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.1>
-        
+
         -- </tkt2927-5.1>
     })
 
@@ -755,7 +755,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.2>
-        
+
         -- </tkt2927-5.2>
     })
 
@@ -769,7 +769,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.3>
-        
+
         -- </tkt2927-5.3>
     })
 
@@ -783,7 +783,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.4>
-        
+
         -- </tkt2927-5.4>
     })
 
@@ -797,7 +797,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.5>
-        
+
         -- </tkt2927-5.5>
     })
 
@@ -811,7 +811,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.6>
-        
+
         -- </tkt2927-5.6>
     })
 
@@ -825,7 +825,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.7>
-        
+
         -- </tkt2927-5.7>
     })
 
@@ -839,7 +839,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.8>
-        
+
         -- </tkt2927-5.8>
     })
 
@@ -853,7 +853,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.9>
-        
+
         -- </tkt2927-5.9>
     })
 
@@ -867,7 +867,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.10>
-        
+
         -- </tkt2927-5.10>
     })
 
@@ -881,7 +881,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.11>
-        
+
         -- </tkt2927-5.11>
     })
 
@@ -895,7 +895,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.12>
-        
+
         -- </tkt2927-5.12>
     })
 
@@ -909,7 +909,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.13>
-        
+
         -- </tkt2927-5.13>
     })
 
@@ -923,7 +923,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.14>
-        
+
         -- </tkt2927-5.14>
     })
 
@@ -937,7 +937,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.15>
-        
+
         -- </tkt2927-5.15>
     })
 
@@ -951,7 +951,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt2927-5.16>
-        
+
         -- </tkt2927-5.16>
     })
 
diff --git a/test/sql-tap/tkt2942.test.lua b/test/sql-tap/tkt2942.test.lua
index d6137a75a..2c06e013e 100755
--- a/test/sql-tap/tkt2942.test.lua
+++ b/test/sql-tap/tkt2942.test.lua
@@ -14,7 +14,7 @@ test:plan(4)
 --
 -------------------------------------------------------------------------
 --
--- Ticket #2942.  
+-- Ticket #2942.
 --
 -- Queries of the form:
 --
diff --git a/test/sql-tap/tkt3201.test.lua b/test/sql-tap/tkt3201.test.lua
index 065b088af..948606093 100755
--- a/test/sql-tap/tkt3201.test.lua
+++ b/test/sql-tap/tkt3201.test.lua
@@ -27,7 +27,7 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES(2, 'two');
     ]], {
         -- <tkt3201-1>
-        
+
         -- </tkt3201-1>
     })
 
@@ -104,7 +104,7 @@ test:do_test(
 test:do_execsql_test(
     "tkt3201-7",
     [[
-        SELECT a, b, c, d FROM t1, t3 WHERE a < c 
+        SELECT a, b, c, d FROM t1, t3 WHERE a < c
     ]], {
         -- <tkt3201-7>
         1, "one", 2, "two"
@@ -124,7 +124,7 @@ test:do_test(
             BEGIN
               INSERT INTO t4_log(x) VALUES(new.x);
             END;
-            CREATE TRIGGER r4_2 AFTER INSERT ON t4 FOR EACH ROW 
+            CREATE TRIGGER r4_2 AFTER INSERT ON t4 FOR EACH ROW
             WHEN new.x=2 BEGIN
               INSERT INTO t4_log(x) VALUES(new.x);
             END;
diff --git a/test/sql-tap/tkt3298.test.lua b/test/sql-tap/tkt3298.test.lua
index 270e4f1ff..2a4831ff9 100755
--- a/test/sql-tap/tkt3298.test.lua
+++ b/test/sql-tap/tkt3298.test.lua
@@ -13,7 +13,7 @@ test:plan(6)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- This file tests changes to the name resolution logic that occurred
 -- in august of 2008 and where associated with tickets #3298 and #3301
 --
diff --git a/test/sql-tap/tkt3357.test.lua b/test/sql-tap/tkt3357.test.lua
index 645d63a73..bcf49974c 100755
--- a/test/sql-tap/tkt3357.test.lua
+++ b/test/sql-tap/tkt3357.test.lua
@@ -31,14 +31,14 @@ test:do_execsql_test(
         insert into b values(1, 'btest');
     ]], {
         -- <tkt3357-1.1>
-        
+
         -- </tkt3357-1.1>
     })
 
 test:do_execsql_test(
     "tkt3357-1.2",
     [[
-        SELECT cc.id, cc.b_id, cc.myvalue, dd.bvalue 
+        SELECT cc.id, cc.b_id, cc.myvalue, dd.bvalue
         FROM (
           SELECT DISTINCT a.id, a.b_id, a.myvalue FROM a
           INNER JOIN b ON a.b_id = b.id WHERE b.bvalue = 'btest'
@@ -55,7 +55,7 @@ test:do_execsql_test(
     [[
         SELECT cc.id, cc.b_id, cc.myvalue
         FROM (
-          SELECT a.id, a.b_id, a.myvalue 
+          SELECT a.id, a.b_id, a.myvalue
           FROM a, b WHERE a.b_id = b.id
         ) cc
         LEFT OUTER JOIN b dd ON cc.b_id = dd.id
@@ -70,7 +70,7 @@ test:do_execsql_test(
     [[
         SELECT cc.id, cc.b_id, cc.myvalue
         FROM (
-          SELECT DISTINCT a.id, a.b_id, a.myvalue 
+          SELECT DISTINCT a.id, a.b_id, a.myvalue
           FROM a, b WHERE a.b_id = b.id
         ) cc
         LEFT OUTER JOIN b dd ON cc.b_id = dd.id
diff --git a/test/sql-tap/tkt3424.test.lua b/test/sql-tap/tkt3424.test.lua
index 5e19936c0..5d7d30bff 100755
--- a/test/sql-tap/tkt3424.test.lua
+++ b/test/sql-tap/tkt3424.test.lua
@@ -33,14 +33,14 @@ test:do_execsql_test(
         INSERT INTO orig VALUES(5, 'AAA','E5');
     ]], {
         -- <tkt3424-1.1>
-        
+
         -- </tkt3424-1.1>
     })
 
 test:do_execsql_test(
     "tkt3424-1.2",
     [[
-        SELECT names.id,names.data,names.code,orig.code,orig.data FROM 
+        SELECT names.id,names.data,names.code,orig.code,orig.data FROM
         names LEFT OUTER JOIN orig
         ON names.data = orig.data AND names.code = orig.code;
     ]], {
@@ -52,17 +52,17 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3424-1.3",
     [[
-        CREATE INDEX udx_orig_code_data ON orig(code, data) 
+        CREATE INDEX udx_orig_code_data ON orig(code, data)
     ]], {
         -- <tkt3424-1.3>
-        
+
         -- </tkt3424-1.3>
     })
 
 test:do_execsql_test(
     "tkt3424-1.4",
     [[
-        SELECT names.id,names.data,names.code,orig.code,orig.data FROM 
+        SELECT names.id,names.data,names.code,orig.code,orig.data FROM
         names LEFT OUTER JOIN orig
         ON names.data = orig.data AND names.code = orig.code;
     ]], {
diff --git a/test/sql-tap/tkt3442.test.lua b/test/sql-tap/tkt3442.test.lua
index 5f9dc3b5a..41856864d 100755
--- a/test/sql-tap/tkt3442.test.lua
+++ b/test/sql-tap/tkt3442.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #3442 has been
--- fixed.  
+-- fixed.
 --
 --
 -- $Id: tkt3442.test,v 1.2 2009/06/05 17:09:12 drh Exp $
@@ -35,7 +35,7 @@ test:do_execsql_test(
         CREATE UNIQUE INDEX ididx ON listhash(id);
     ]], {
         -- <tkt3442-1.1>
-        
+
         -- </tkt3442-1.1>
     })
 
diff --git a/test/sql-tap/tkt3493.test.lua b/test/sql-tap/tkt3493.test.lua
index 9387c5207..0aac0ddb9 100755
--- a/test/sql-tap/tkt3493.test.lua
+++ b/test/sql-tap/tkt3493.test.lua
@@ -36,20 +36,20 @@ test:do_execsql_test(
         COMMIT;
     ]], {
         -- <tkt3493-1.1>
-        
+
         -- </tkt3493-1.1>
     })
 
 test:do_execsql_test(
     "tkt3493-1.2",
     [[
-        SELECT 
-          CASE 
-             WHEN B.val = 1 THEN 'XYZ' 
-             ELSE A.val 
+        SELECT
+          CASE
+             WHEN B.val = 1 THEN 'XYZ'
+             ELSE A.val
           END AS Col1
-        FROM B  
-        LEFT OUTER JOIN A_B ON B.id = A_B.B_id  
+        FROM B
+        LEFT OUTER JOIN A_B ON B.id = A_B.B_id
         LEFT OUTER JOIN A ON A.id = A_B.A_id
         ORDER BY Col1 ASC;
     ]], {
@@ -62,12 +62,12 @@ test:do_execsql_test(
     "tkt3493-1.3",
     [[
         SELECT DISTINCT
-          CASE 
-             WHEN B.val = 1 THEN 'XYZ' 
-             ELSE A.val 
+          CASE
+             WHEN B.val = 1 THEN 'XYZ'
+             ELSE A.val
           END AS Col1
-        FROM B  
-        LEFT OUTER JOIN A_B ON B.id = A_B.B_id  
+        FROM B
+        LEFT OUTER JOIN A_B ON B.id = A_B.B_id
         LEFT OUTER JOIN A ON A.id = A_B.A_id
         ORDER BY Col1 ASC;
     ]], {
@@ -89,9 +89,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-1.5",
     [[
-        SELECT DISTINCT 
-          b.val, 
-          CASE WHEN b.val = 1 THEN 'xyz' ELSE b.val END AS col1 
+        SELECT DISTINCT
+          b.val,
+          CASE WHEN b.val = 1 THEN 'xyz' ELSE b.val END AS col1
         FROM b;
     ]], {
         -- <tkt3493-1.5>
@@ -102,9 +102,9 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-1.6",
     [[
-        SELECT DISTINCT 
-          b.val, 
-          CASE WHEN b.val = '1' THEN 'xyz' ELSE b.val END AS col1 
+        SELECT DISTINCT
+          b.val,
+          CASE WHEN b.val = '1' THEN 'xyz' ELSE b.val END AS col1
         FROM b;
     ]], {
         -- <tkt3493-1.6>
@@ -119,14 +119,14 @@ test:do_execsql_test(
         INSERT INTO t1 VALUES('123', 456);
     ]], {
         -- <tkt3493-2.1>
-        
+
         -- </tkt3493-2.1>
     })
 
 test:do_execsql_test(
     "tkt3493-2.2.1",
     [[
-        SELECT a=123 FROM t1 GROUP BY a 
+        SELECT a=123 FROM t1 GROUP BY a
     ]], {
         -- <tkt3493-2.2.1>
         true
@@ -136,7 +136,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.2",
     [[
-        SELECT a=123 FROM t1 
+        SELECT a=123 FROM t1
     ]], {
         -- <tkt3493-2.2.2>
         true
@@ -146,7 +146,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.3",
     [[
-        SELECT a='123' FROM t1 
+        SELECT a='123' FROM t1
     ]], {
         -- <tkt3493-2.2.3>
         true
@@ -156,7 +156,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.4",
     [[
-        SELECT count(*), a=123 FROM t1 
+        SELECT count(*), a=123 FROM t1
     ]], {
         -- <tkt3493-2.2.4>
         1, true
@@ -166,7 +166,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.2.5",
     [[
-        SELECT count(*), +a=123 FROM t1 
+        SELECT count(*), +a=123 FROM t1
     ]], {
         -- <tkt3493-2.2.5>
         1, true
@@ -176,7 +176,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.3.3",
     [[
-        SELECT b='456' FROM t1 GROUP BY a 
+        SELECT b='456' FROM t1 GROUP BY a
     ]], {
         -- <tkt3493-2.3.3>
         true
@@ -186,7 +186,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.3.1",
     [[
-        SELECT b='456' FROM t1 GROUP BY b 
+        SELECT b='456' FROM t1 GROUP BY b
     ]], {
         -- <tkt3493-2.3.1>
         true
@@ -196,7 +196,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.3.2",
     [[
-        SELECT b='456' FROM t1 
+        SELECT b='456' FROM t1
     ]], {
         -- <tkt3493-2.3.2>
         true
@@ -206,7 +206,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.4.1",
     [[
-        SELECT typeof(a), a FROM t1 GROUP BY a HAVING a=123 
+        SELECT typeof(a), a FROM t1 GROUP BY a HAVING a=123
     ]], {
         -- <tkt3493-2.4.1>
         "string", "123"
@@ -216,7 +216,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.4.2",
     [[
-        SELECT typeof(a), a FROM t1 GROUP BY b HAVING a=123 
+        SELECT typeof(a), a FROM t1 GROUP BY b HAVING a=123
     ]], {
         -- <tkt3493-2.4.2>
         "string", "123"
@@ -226,7 +226,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.5.1",
     [[
-        SELECT typeof(b), b FROM t1 GROUP BY a HAVING b='456' 
+        SELECT typeof(b), b FROM t1 GROUP BY a HAVING b='456'
     ]], {
         -- <tkt3493-2.5.1>
         "integer", 456
@@ -236,7 +236,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-2.5.2",
     [[
-        SELECT typeof(b), b FROM t1 GROUP BY b HAVING b='456' 
+        SELECT typeof(b), b FROM t1 GROUP BY b HAVING b='456'
     ]], {
         -- <tkt3493-2.5.2>
         "integer", 456
@@ -250,7 +250,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES('aBc', 'DeF');
     ]], {
         -- <tkt3493-3.1>
-        
+
         -- </tkt3493-3.1>
     })
 
@@ -258,7 +258,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-3.2.1",
     [[
-        SELECT a='abc' FROM t2 GROUP BY a 
+        SELECT a='abc' FROM t2 GROUP BY a
     ]], {
         -- <tkt3493-3.2.1>
         true
@@ -268,7 +268,7 @@ test:do_execsql_test(
 test:do_execsql_test(
     "tkt3493-3.2.2",
     [[
-        SELECT a='abc' FROM t2 
+        SELECT a='abc' FROM t2
     ]], {
         -- <tkt3493-3.2.2>
         true
diff --git a/test/sql-tap/tkt3554.test.lua b/test/sql-tap/tkt3554.test.lua
index c213f5808..1c7253128 100755
--- a/test/sql-tap/tkt3554.test.lua
+++ b/test/sql-tap/tkt3554.test.lua
@@ -16,7 +16,7 @@ test:plan(4)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #3554 has been
--- fixed.  
+-- fixed.
 --
 -- $Id: tkt3554.test,v 1.2 2009/06/05 17:09:12 drh Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/tkt3581.test.lua b/test/sql-tap/tkt3581.test.lua
index 2e079d270..0cd11a77d 100755
--- a/test/sql-tap/tkt3581.test.lua
+++ b/test/sql-tap/tkt3581.test.lua
@@ -16,7 +16,7 @@ test:plan(3)
 -- This file implements regression tests for sql library.
 --
 -- This file implements tests to verify that ticket #3581 has been
--- fixed.  
+-- fixed.
 --
 -- $Id: tkt3581.test,v 1.1 2009/01/14 01:10:40 drh Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -34,7 +34,7 @@ test:do_test(
         ]]
     end, {
         -- <tkt3581-1.1>
-        
+
         -- </tkt3581-1.1>
     })
 
diff --git a/test/sql-tap/tkt3935.test.lua b/test/sql-tap/tkt3935.test.lua
index 7138e9e6a..f3bbe0b9f 100755
--- a/test/sql-tap/tkt3935.test.lua
+++ b/test/sql-tap/tkt3935.test.lua
@@ -27,30 +27,31 @@ test:do_execsql_test(
         CREATE TABLE t2(c INT primary key, d INT);
     ]], {
         -- <tkt3935.1>
-        
+
         -- </tkt3935.1>
     })
 
 test:do_execsql_test(
     "tkt3935.2",
     [[
-        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1 
+        SELECT j1.b FROM ( SELECT * FROM t1 INNER JOIN t2 ON a=c ) AS j1
     ]], {
         -- <tkt3935.2>
-        
+
         -- </tkt3935.2>
     })
 
 test:do_execsql_test(
     "tkt3935.3",
     [[
-        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1 
+        SELECT j1.b FROM (t1 INNER JOIN t2 ON a=c) AS j1
     ]], {
         -- <tkt3935.3>
-        
+
         -- </tkt3935.3>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.4",
     [[
@@ -61,6 +62,7 @@ test:do_catchsql_test(
         -- </tkt3935.4>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.5",
     [[
@@ -71,6 +73,7 @@ test:do_catchsql_test(
         -- </tkt3935.5>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.6",
     [[
@@ -81,6 +84,7 @@ test:do_catchsql_test(
         -- </tkt3935.6>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.7",
     [[
@@ -91,6 +95,7 @@ test:do_catchsql_test(
         -- </tkt3935.7>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.8",
     [[
@@ -101,6 +106,7 @@ test:do_catchsql_test(
         -- </tkt3935.8>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.9",
     [[
@@ -111,6 +117,7 @@ test:do_catchsql_test(
         -- </tkt3935.9>
     })
 
+-- luacheck: ignore
 test:do_catchsql_test(
     "tkt3935.10",
     [[
diff --git a/test/sql-tap/tokenize.test.lua b/test/sql-tap/tokenize.test.lua
index 8d19a507c..1c15b2abf 100755
--- a/test/sql-tap/tokenize.test.lua
+++ b/test/sql-tap/tokenize.test.lua
@@ -152,7 +152,7 @@ test:do_catchsql_test(
 test:do_catchsql_test(
     "tokenize-2.2",
     [[
-        SELECT 1, 2 /* 
+        SELECT 1, 2 /*
     ]], {
         -- <tokenize-2.2>
         0, {1, 2}
diff --git a/test/sql-tap/transitive1.test.lua b/test/sql-tap/transitive1.test.lua
index af65dc518..dbc2559fa 100755
--- a/test/sql-tap/transitive1.test.lua
+++ b/test/sql-tap/transitive1.test.lua
@@ -343,7 +343,7 @@ test:do_execsql_test(
                    ON files.idpath = path.idpath
                  LEFT JOIN bookmark
                         ON bookmark.idfile = episode.idfile
-                           AND bookmark.type = 1; 
+                           AND bookmark.type = 1;
         CREATE VIEW tvshowview
         AS
           SELECT tvshow.*,
@@ -362,7 +362,7 @@ test:do_execsql_test(
                         ON episode.idshow = tvshow.idshow
                  LEFT JOIN files
                         ON files.idfile = episode.idfile
-          GROUP  BY tvshow.idshow; 
+          GROUP  BY tvshow.idshow;
         SELECT
           episodeview.c12,
           path.strPath,
diff --git a/test/sql-tap/triggerB.test.lua b/test/sql-tap/triggerB.test.lua
index 55b3bc32f..7500ac9f6 100755
--- a/test/sql-tap/triggerB.test.lua
+++ b/test/sql-tap/triggerB.test.lua
@@ -41,7 +41,7 @@ test:do_execsql_test(
         -- </triggerB-1.1>
     })
 
--- MUST_WORK_TEST 
+-- MUST_WORK_TEST
 -- do_test triggerB-1.2 {
 --   execsql {
 --     UPDATE vx SET y = yy;
@@ -153,7 +153,7 @@ test:do_test(
             );
         ]]
         -- for _ in X(0, "X!for", [=[["set i 0","$i<=65","incr i"]]=]) do
-        for i=0,65 do    
+        for i=0,65 do
             local sql = string.format([[
                     CREATE TRIGGER t3c%s AFTER UPDATE ON t3
                     FOR EACH ROW
@@ -169,15 +169,15 @@ test:do_test(
         ]]
     end, {
         -- <triggerB-3.1>
-        
+
         -- </triggerB-3.1>
     })
 
 -- for _ in X(0, "X!for", [=[["set i 0","$i<=64","incr i"]]=]) do
-for i=0,64 do    
+for i=0,64 do
 --    X(139, "X!cmd", [=[["do_test",["triggerB-3.2.",["i"],".1"],["\n    execsql {\n      UPDATE t3 SET c",["i"],"='b",["i"],"';\n      SELECT * FROM t3_changes ORDER BY colnum DESC LIMIT 1;\n    }\n  "],[["i"]," a",["i"]," b",["i"]]]]=])
     test:do_execsql_test("triggerB-3.2."..i..".1",
-                         string.format([[UPDATE t3 SET c%d='b%d'; 
+                         string.format([[UPDATE t3 SET c%d='b%d';
                                          SELECT * FROM t3_changes ORDER BY colnum DESC LIMIT 1; ]],
                                        i, i),
                          {i, string.format("a%d", i), string.format("b%d", i)})
diff --git a/test/sql-tap/types2.test.lua b/test/sql-tap/types2.test.lua
index 04ed3070d..e5df78b9e 100755
--- a/test/sql-tap/types2.test.lua
+++ b/test/sql-tap/types2.test.lua
@@ -199,7 +199,7 @@ test_bool("types2-4.26", "o1='500'", "'500' > o1", 0)
 test_bool("types2-4.27", "o1='500'", "500.0 > o1", 0)
 test_bool("types2-4.28", "o1='500'", "'500.0' > o1", 1)
 -- types2-5.* - The 'IN (x, y....)' operator with no index.
--- 
+--
 -- Compare literals against literals (no affinity applied)
 test_bool("types2-5.1", "", "(NULL IN ('10.0', 20)) IS NULL", 1)
 test_bool("types2-5.2", "", "10 IN ('10.0', 20)", 0)
@@ -254,9 +254,9 @@ test_bool("types2-5.43", "t1='010',n1=10", "n1 IN (5,t1,11)", 1)
 
 
 -- Tests named types2-6.* use the same infrastructure as the types2-2.*
--- tests. The contents of the vals array is repeated here for easy 
+-- tests. The contents of the vals array is repeated here for easy
 -- reference.
--- 
+--
 -- set vals [list 10 10.0 '10' '10.0' 20 20.0 '20' '20.0' 30 30.0 '30' '30.0']
 --                1  2    3    4      5  6    7    8      9  10   11   12
 test_boolset("types2-6.1", "o IN ('10', 30)", {3, 9, 10})
@@ -271,7 +271,7 @@ test_boolset("types2-6.8", "i IN (20.0, 30.0)", {5, 6, 7, 8, 9, 10, 11, 12})
 test_boolset("types2-6.9", "id IN (1, 6, 10)", {1, 6, 10})
 
 
--- Tests types2-7.* concentrate on expressions of the form 
+-- Tests types2-7.* concentrate on expressions of the form
 -- "x IN (SELECT...)" with no index.
 test:execsql [[
     CREATE TABLE t3(id  INT primary key, i INTEGER, n NUMERIC, t TEXT, o SCALAR);
diff --git a/test/sql-tap/update.test.lua b/test/sql-tap/update.test.lua
index ac6ee8803..dca086884 100755
--- a/test/sql-tap/update.test.lua
+++ b/test/sql-tap/update.test.lua
@@ -46,7 +46,7 @@ test:do_catchsql_test("update-1.1", [[
 test:do_test("update-3.1", function()
   test:execsql "CREATE TABLE test1(id  INT primary key, f1 int,f2 int)"
   -- for _ in X(0, "X!for", [=[["set i 1","$i<=10","incr i"]]=]) do
-  for i = 1, 10 do    
+  for i = 1, 10 do
     local sql = string.format("INSERT INTO test1 VALUES(%s,%s,%s)", i, i, bit.lshift(1, i)) -- X(0, "X!expr", [=[["<<",1,["i"]]]=]))
     test:execsql(sql)
   end
@@ -89,7 +89,7 @@ test:do_execsql_test("update-3.5", [[
   UPDATE test1 SET f2=f2*3
 ]], {
   -- <update-3.5>
-  
+
   -- </update-3.5>
 })
 
@@ -182,7 +182,7 @@ test:do_test("update-3.13", function()
   return test:execsql "UPDATE test1 SET F2=f1, F1=f2"
 end, {
   -- <update-3.13>
-  
+
   -- </update-3.13>
 })
 
@@ -348,7 +348,7 @@ test:do_execsql_test("update-5.5", [[
   UPDATE test1 SET f1=f1-1 WHERE f1>100 and f2==128
 ]], {
   -- <update-5.5>
-  
+
   -- </update-5.5>
 })
 
@@ -372,7 +372,7 @@ test:do_execsql_test("update-5.5.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-5.5.3>
-  
+
   -- </update-5.5.3>
 })
 
@@ -420,7 +420,7 @@ test:do_execsql_test("update-5.6.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-5.6.3>
-  
+
   -- </update-5.6.3>
 })
 
@@ -482,7 +482,7 @@ test:do_execsql_test("update-6.1.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==88 ORDER BY f1,f2
 ]], {
   -- <update-6.1.3>
-  
+
   -- </update-6.1.3>
 })
 
@@ -516,7 +516,7 @@ test:do_execsql_test("update-6.3.2", [[
   SELECT f1,f2 FROM test1 WHERE f2==89 ORDER BY f1,f2
 ]], {
   -- <update-6.3.2>
-  
+
   -- </update-6.3.2>
 })
 
@@ -582,7 +582,7 @@ test:do_execsql_test("update-6.5.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-6.5.2>
-  
+
   -- </update-6.5.2>
 })
 
@@ -623,7 +623,7 @@ test:do_execsql_test("update-6.6.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-6.6.2>
-  
+
   -- </update-6.6.2>
 })
 
@@ -685,7 +685,7 @@ test:do_execsql_test("update-7.1.3", [[
   SELECT f1,f2 FROM test1 WHERE f1==88 ORDER BY f1,f2
 ]], {
   -- <update-7.1.3>
-  
+
   -- </update-7.1.3>
 })
 
@@ -720,7 +720,7 @@ test:do_execsql_test("update-7.3.2", [[
   SELECT f1,f2 FROM test1 WHERE f2==89 ORDER BY f1,f2
 ]], {
   -- <update-7.3.2>
-  
+
   -- </update-7.3.2>
 })
 
@@ -786,7 +786,7 @@ test:do_execsql_test("update-7.5.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-7.5.2>
-  
+
   -- </update-7.5.2>
 })
 
@@ -827,7 +827,7 @@ test:do_execsql_test("update-7.6.2", [[
   SELECT f1,f2 FROM test1 WHERE f1==778 ORDER BY f1,f2
 ]], {
   -- <update-7.6.2>
-  
+
   -- </update-7.6.2>
 })
 
diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
index 67f461132..f43fccb6b 100755
--- a/test/sql-tap/view.test.lua
+++ b/test/sql-tap/view.test.lua
@@ -32,7 +32,7 @@ test:plan(83)
 --     SELECT * FROM t1;
 --   }
 -- } {1 2 3 4 5 6 7 8 9}
--- 
+--
 test:do_execsql_test(
     "view-1.0",
     [[
@@ -232,7 +232,7 @@ test:do_execsql_test(
         -- </view-2.6>
     })
 
--- 
+--
 -- Test that column name of views are generated correctly.
 --
 test:do_execsql2_test(
@@ -1024,7 +1024,7 @@ test:do_execsql_test(
         CREATE VIEW v10 AS SELECT c1 FROM (SELECT t10.c1 FROM t10);
     ]], {
         -- <view-20.1>
-        
+
         -- </view-20.1>
     })
 
@@ -1037,7 +1037,7 @@ test:do_execsql_test(
         CREATE VIEW v10 AS SELECT c1 FROM (SELECT t10.c1 FROM t10);
     ]], {
         -- <view-20.1>
-        
+
         -- </view-20.1>
     })
 
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index db7edd539..58b795cd2 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -53,7 +53,7 @@ test:do_test(
         ]]
     end, {
         -- <where2-1.0>
-        
+
         -- </where2-1.0>
     })
 
@@ -80,7 +80,7 @@ end
 -- it appends the name of the table and index used.
 --
 
--- This procedure executes the SQL.  Then it appends 
+-- This procedure executes the SQL.  Then it appends
 -- the names of the table and index used
 --
 local function queryplan(sql)
@@ -899,7 +899,7 @@ test:do_test(
         "where2-7.4",
         function()
             test:execsql('create unique index i9y on t9(y);')
-            return cksort([[                   
+            return cksort([[
                    select * from t8, t9 where a=1 and y=3 order by b, x]])
         end, {
             -- <where2-7.4>
@@ -924,7 +924,7 @@ test:do_execsql_test(
         SELECT * FROM t1 WHERE x IN (20,21) AND y IN (1,2)
     ]], {
         -- <where2-8.1>
-        
+
         -- </where2-8.1>
     })
 
@@ -934,7 +934,7 @@ test:do_execsql_test(
         SELECT * FROM t1 WHERE x IN (1,2) AND y IN (-5,-6)
     ]], {
         -- <where2-8.2>
-        
+
         -- </where2-8.2>
     })
 
@@ -1031,7 +1031,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 2 AND 4)
     ]], {
         -- <where2-8.9>
-        
+
         -- </where2-8.9>
     })
 
@@ -1044,7 +1044,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.10>
-        
+
         -- </where2-8.10>
     })
 
@@ -1057,7 +1057,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.11>
-        
+
         -- </where2-8.11>
     })
 
@@ -1070,7 +1070,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN -4 AND -2)
     ]], {
         -- <where2-8.12>
-        
+
         -- </where2-8.12>
     })
 
@@ -1083,7 +1083,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.13>
-        
+
         -- </where2-8.13>
     })
 
@@ -1096,7 +1096,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.14>
-        
+
         -- </where2-8.14>
     })
 
@@ -1109,7 +1109,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 200 AND 300)
     ]], {
         -- <where2-8.15>
-        
+
         -- </where2-8.15>
     })
 
@@ -1122,7 +1122,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.16>
-        
+
         -- </where2-8.16>
     })
 
@@ -1135,7 +1135,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.17>
-        
+
         -- </where2-8.17>
     })
 
@@ -1148,7 +1148,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE +w BETWEEN 200 AND 300)
     ]], {
         -- <where2-8.18>
-        
+
         -- </where2-8.18>
     })
 
@@ -1161,7 +1161,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE +w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.19>
-        
+
         -- </where2-8.19>
     })
 
@@ -1174,7 +1174,7 @@ test:do_execsql_test(
            AND z IN (SELECT z FROM t1 WHERE +w BETWEEN 10 AND 20)
     ]], {
         -- <where2-8.20>
-        
+
         -- </where2-8.20>
     })
 
diff --git a/test/sql-tap/where3.test.lua b/test/sql-tap/where3.test.lua
index bc6e8108e..9b2bc2e25 100755
--- a/test/sql-tap/where3.test.lua
+++ b/test/sql-tap/where3.test.lua
@@ -113,7 +113,7 @@ test:do_test(
 
 
 
--- This procedure executes the SQL.  Then it appends 
+-- This procedure executes the SQL.  Then it appends
 -- the names of the table and index used
 --
 local function queryplan(sql)
@@ -158,8 +158,8 @@ local function queryplan(sql)
 end
 
 -- If you have a from clause of the form:   A B C left join D
--- then make sure the query optimizer is able to reorder the 
--- A B C part anyway it wants. 
+-- then make sure the query optimizer is able to reorder the
+-- A B C part anyway it wants.
 --
 -- Following the fix to ticket #1652, there was a time when
 -- the C table would not reorder.  So the following reorderings
@@ -344,7 +344,7 @@ test:do_test(
 -- If the outer loop must be a full table scan, do not let ANALYZE trick
 -- the planner into use a table for the outer loop that might be indexable
 -- if held until an inner loop.
--- 
+--
 test:do_execsql_test(
     "where3-3.0",
     [[
@@ -357,7 +357,7 @@ test:do_execsql_test(
         SELECT * FROM t302, t301 WHERE t302.x=5 AND t301.a=t302.y;
     ]], {
         -- <where3-3.0>
-        
+
         -- </where3-3.0>
     })
 
@@ -367,7 +367,7 @@ test:do_execsql_test(
         SELECT * FROM t301, t302 WHERE t302.x=5 AND t301.a=t302.y;
     ]], {
         -- <where3-3.1>
-        
+
         -- </where3-3.1>
     })
 
@@ -377,7 +377,7 @@ test:do_execsql_test(
         SELECT * FROM t301 WHERE c=3 AND a IS NULL;
     ]], {
         -- <where3-3.2>
-        
+
         -- </where3-3.2>
     })
 
@@ -459,55 +459,55 @@ test:do_execsql_test(
         CREATE INDEX bbb_222 ON bbb (parent, position);
         CREATE INDEX bbb_333 ON bbb (fk, lastModified);
 
-         SELECT bbb.title AS tag_title 
-           FROM aaa JOIN bbb ON bbb.id = aaa.parent  
+         SELECT bbb.title AS tag_title
+           FROM aaa JOIN bbb ON bbb.id = aaa.parent
           WHERE aaa.fk = 'constant'
             AND LENGTH(bbb.title) > 0
             AND bbb.parent = 4
           ORDER BY bbb.title COLLATE "unicode_ci" ASC;
     ]], {
         -- <where3-5.0>
-        
+
         -- </where3-5.0>
     })
 
 -- do_execsql_test where3-5.1 {
 --   EXPLAIN QUERY PLAN
---    SELECT bbb.title AS tag_title 
---      FROM aaa JOIN aaa AS bbb ON bbb.id = aaa.parent  
+--    SELECT bbb.title AS tag_title
+--      FROM aaa JOIN aaa AS bbb ON bbb.id = aaa.parent
 --     WHERE aaa.fk = 'constant'
 --       AND LENGTH(bbb.title) > 0
 --       AND bbb.parent = 4
 --     ORDER BY bbb.title COLLATE NOCASE ASC;
 -- } {
---   0 0 0 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)} 
---   0 1 1 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)} 
+--   0 0 0 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)}
+--   0 1 1 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 -- do_execsql_test where3-5.2 {
 --   EXPLAIN QUERY PLAN
---    SELECT bbb.title AS tag_title 
---      FROM bbb JOIN aaa ON bbb.id = aaa.parent  
+--    SELECT bbb.title AS tag_title
+--      FROM bbb JOIN aaa ON bbb.id = aaa.parent
 --     WHERE aaa.fk = 'constant'
 --       AND LENGTH(bbb.title) > 0
 --       AND bbb.parent = 4
 --     ORDER BY bbb.title COLLATE NOCASE ASC;
 -- } {
---   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)} 
---   0 1 0 {SEARCH TABLE bbb USING INTEGER PRIMARY KEY (rowid=?)} 
+--   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)}
+--   0 1 0 {SEARCH TABLE bbb USING INTEGER PRIMARY KEY (rowid=?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 -- do_execsql_test where3-5.3 {
 --   EXPLAIN QUERY PLAN
---    SELECT bbb.title AS tag_title 
---      FROM aaa AS bbb JOIN aaa ON bbb.id = aaa.parent  
+--    SELECT bbb.title AS tag_title
+--      FROM aaa AS bbb JOIN aaa ON bbb.id = aaa.parent
 --     WHERE aaa.fk = 'constant'
 --       AND LENGTH(bbb.title) > 0
 --       AND bbb.parent = 4
 --     ORDER BY bbb.title COLLATE NOCASE ASC;
 -- } {
---   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)} 
---   0 1 0 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)} 
+--   0 0 1 {SEARCH TABLE aaa USING INDEX aaa_333 (fk=?)}
+--   0 1 0 {SEARCH TABLE aaa AS bbb USING INTEGER PRIMARY KEY (rowid=?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 -- Name resolution with NATURAL JOIN and USING
@@ -535,7 +535,7 @@ test:do_test(
         ]]
     end, {
         -- <where3-6.setup>
-        
+
         -- </where3-6.setup>
     })
 
@@ -649,7 +649,7 @@ test:do_execsql_test(
         INSERT INTO t74 VALUES(234,678);
     ]], {
         -- <where3-7-setup>
-        
+
         -- </where3-7-setup>
     })
 
@@ -671,7 +671,7 @@ local disabled_opt = "none"
         [[
             SELECT x1 FROM t71 LEFT JOIN t72 ON x2=y1 WHERE y2 IS NULL;
         ]], {
-            
+
         })
 
     test:do_execsql_test(
diff --git a/test/sql-tap/where4.test.lua b/test/sql-tap/where4.test.lua
index 8eae3dc2c..1467faa9b 100755
--- a/test/sql-tap/where4.test.lua
+++ b/test/sql-tap/where4.test.lua
@@ -171,7 +171,7 @@ test:do_execsql_test(
           WHERE +t2.col1 IS NULL;
     ]], {
         -- <where4-4.1>
-        
+
         -- </where4-4.1>
     })
 
@@ -182,7 +182,7 @@ test:do_execsql_test(
           WHERE t2.col1 IS NULL;
     ]], {
         -- <where4-4.2>
-        
+
         -- </where4-4.2>
     })
 
@@ -193,7 +193,7 @@ test:do_execsql_test(
           WHERE +t1.col1 IS NULL;
     ]], {
         -- <where4-4.3>
-        
+
         -- </where4-4.3>
     })
 
@@ -204,7 +204,7 @@ test:do_execsql_test(
           WHERE t1.col1 IS NULL;
     ]], {
         -- <where4-4.4>
-        
+
         -- </where4-4.4>
     })
 
@@ -227,7 +227,7 @@ test:do_execsql_test(
                   LEFT JOIN t4 b2 ON b2.x=b1.x AND b2.y IN (b1.y);
     ]], {
         -- <where4-5.2>
-        1, '', '', '', '', '', '', 2, '', '', '', '', '', '', 3, '', '', '', '', '', '' 
+        1, '', '', '', '', '', '', 2, '', '', '', '', '', '', 3, '', '', '', '', '', ''
         -- </where4-5.2>
     })
 
@@ -242,7 +242,7 @@ test:do_execsql_test(
         INSERT INTO t4 VALUES(2,2,22);
     ]], {
         -- <where4-5.2>
-        
+
         -- </where4-5.2>
     })
 
@@ -281,7 +281,7 @@ test:do_test(
         ]]
     end, {
         -- <where4-7.1>
-        
+
         -- </where4-7.1>
     })
 
@@ -303,7 +303,7 @@ test:do_test(
 --   }
 -- } {}
 -- # At one point the sub-select inside the aggregate sum() function in the
--- # following query was leaking a couple of stack entries. This query 
+-- # following query was leaking a couple of stack entries. This query
 -- # runs the SELECT in a loop enough times that an assert() fails. Or rather,
 -- # did fail before the bug was fixed.
 -- #
diff --git a/test/sql-tap/where6.test.lua b/test/sql-tap/where6.test.lua
index f9de30dbc..5c5377f9c 100755
--- a/test/sql-tap/where6.test.lua
+++ b/test/sql-tap/where6.test.lua
@@ -85,10 +85,10 @@ test:do_test(
     function()
         -- return X(58, "X!cmd", [=[["explain_no_trace","SELECT * FROM t1 LEFT JOIN t2 ON x=b WHERE 1=c"]]=])
         return test:explain_no_trace('SELECT * FROM t1 LEFT JOIN t2 ON x=b WHERE 1=c')
-    end, 
+    end,
     -- <where6-1.6>
     -- X(57, "X!cmd", [=[["explain_no_trace","SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE c=1"]]=])
-    test:explain_no_trace('SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE c=1')    
+    test:explain_no_trace('SELECT * FROM t1 LEFT JOIN t2 ON b=x WHERE c=1')
     -- </where6-1.6>
     )
 
@@ -232,7 +232,7 @@ test:do_execsql_test(
 
 -- Ticket [ebdbadade5b]:
 -- If the ON close on a LEFT JOIN is of the form x=y where both x and y
--- are indexed columns on tables to left of the join, then do not use that 
+-- are indexed columns on tables to left of the join, then do not use that
 -- term with indices to either table.
 --
 test:do_test(
diff --git a/test/sql-tap/where7.test.lua b/test/sql-tap/where7.test.lua
index d3e7d91fe..ec577cb7d 100755
--- a/test/sql-tap/where7.test.lua
+++ b/test/sql-tap/where7.test.lua
@@ -450,7 +450,7 @@ test:do_test(
         ]]
     end, {
         -- <where7-2.1>
-        
+
         -- </where7-2.1>
     })
 
@@ -37491,7 +37491,7 @@ test:do_test(
 --   CREATE INDEX t302_c8_c3 on t302(c8, c3);
 --   CREATE INDEX t302_c5 on t302(c5);
 --   EXPLAIN QUERY PLAN
---   SELECT t302.c1 
+--   SELECT t302.c1
 --     FROM t302 JOIN t301 ON t302.c8 = +t301.c8
 --     WHERE t302.c2 = 19571
 --       AND t302.c3 > 1287603136
@@ -37499,9 +37499,9 @@ test:do_test(
 --            OR t301.c8 = 1407424651264000)
 --    ORDER BY t302.c5 LIMIT 200;
 -- } {
---   0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?)} 
---   0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?)} 
---   0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?)} 
+--   0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?)}
+--   0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?)}
+--   0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?)}
 --   0 0 0 {USE TEMP B-TREE FOR ORDER BY}
 -- }
 
diff --git a/test/sql-tap/whereD.test.lua b/test/sql-tap/whereD.test.lua
index e0e9a3853..a3851e526 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -15,7 +15,7 @@ test:plan(36)
 -------------------------------------------------------------------------
 -- This file implements regression tests for sql library.  The
 -- focus of this file is testing that an index may be used as a covering
--- index when there are OR expressions in the WHERE clause. 
+-- index when there are OR expressions in the WHERE clause.
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
@@ -168,7 +168,7 @@ test:do_execsql_test(
         SELECT k FROM t WHERE (i=1 AND j=2) OR (i=2 AND j=1) OR (i=3 AND j=4);
     ]], {
         -- <1.15>
-        
+
         -- </1.15>
     })
 
@@ -199,7 +199,7 @@ test:do_execsql_test(
         INSERT INTO t2 VALUES(3,4);
     ]], {
         -- <2.0>
-        
+
         -- </2.0>
     })
 
diff --git a/test/sql-tap/whereF.test.lua b/test/sql-tap/whereF.test.lua
index 73c87abc9..3ac4f7a24 100755
--- a/test/sql-tap/whereF.test.lua
+++ b/test/sql-tap/whereF.test.lua
@@ -13,7 +13,7 @@ test:plan(13)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Test cases for query planning decisions.
 --
 -- The tests in this file demonstrate the behaviour of the query planner
@@ -55,7 +55,7 @@ test:do_execsql_test(
         CREATE TABLE t2(d INT PRIMARY KEY, e INT, f INT);
     ]], {
         -- <1.0>
-        
+
         -- </1.0>
     })
 
@@ -83,7 +83,7 @@ test:do_execsql_test(
         CREATE UNIQUE INDEX i2 ON t1(b);
     ]], {
         -- <2.0>
-        
+
         -- </2.0>
     })
 
@@ -120,7 +120,7 @@ test:do_execsql_test(
         CREATE TABLE t2(d INT PRIMARY KEY, e INT, f INT);
     ]], {
         -- <3.0>
-        
+
         -- </3.0>
     })
 
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 2a76d2438..49501a4a5 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -13,7 +13,7 @@ test:plan(23)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- 
+--
 -- Test cases for query planning decisions and the likely(), unlikely(), and
 -- likelihood() functions.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
@@ -65,7 +65,7 @@ test:do_execsql_test(
         INSERT INTO track VALUES(10403, 6, 104, 'Qui tollis');
     ]], {
         -- <whereG-1.0>
-        
+
         -- </whereG-1.0>
     })
 
@@ -233,7 +233,7 @@ test:do_execsql_test(
         CREATE TABLE b(b1  INT PRIMARY KEY, b2 INT );
     ]], {
         -- <whereG-3.0>
-        
+
         -- </whereG-3.0>
     })
 
@@ -269,7 +269,7 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- Test that likelihood() specifications on indexed terms are taken into 
+-- Test that likelihood() specifications on indexed terms are taken into
 -- account by various forms of loops.
 --
 --   5.1.*: open ended range scans
diff --git a/test/sql-tap/whereI.test.lua b/test/sql-tap/whereI.test.lua
index 43614b0eb..e2b28565f 100755
--- a/test/sql-tap/whereI.test.lua
+++ b/test/sql-tap/whereI.test.lua
@@ -13,7 +13,7 @@ test:plan(7)
 --    May you share freely, never taking more than you give.
 --
 -------------------------------------------------------------------------
--- The focus of this file is testing the OR optimization on WITHOUT ROWID 
+-- The focus of this file is testing the OR optimization on WITHOUT ROWID
 -- tables.
 --
 -- Note: Tarantool has no rowid support, so all tables are WITHOUT ROWID.
@@ -33,7 +33,7 @@ test:do_execsql_test(1.0, [[
 -- do_eqp_test 1.1 {
 --   SELECT a FROM t1 WHERE b='b' OR c='x'
 -- } {
---   0 0 0 {SEARCH TABLE t1 USING INDEX i1 (b=?)} 
+--   0 0 0 {SEARCH TABLE t1 USING INDEX i1 (b=?)}
 --   0 0 0 {SEARCH TABLE t1 USING INDEX i2 (c=?)}
 -- }
 test:do_execsql_test(1.2, [[
@@ -68,7 +68,7 @@ test:do_execsql_test(2.0, [[
 -- do_eqp_test 2.1 {
 --   SELECT a FROM t2 WHERE b='b' OR c='x'
 -- } {
---   0 0 0 {SEARCH TABLE t2 USING INDEX i3 (b=?)} 
+--   0 0 0 {SEARCH TABLE t2 USING INDEX i3 (b=?)}
 --   0 0 0 {SEARCH TABLE t2 USING INDEX i4 (c=?)}
 -- }
 test:do_execsql_test(2.2, [[
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 32e187186..35f3dabb3 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -20,7 +20,7 @@ test:plan(64)
 -- ["source",[["testdir"],"\/tester.tcl"]]
 -- if X(0, "X!capable", [["!cte"]]) then
 --   test:finish_test()
---  return 
+--  return
 -- end
 
 test:do_execsql_test(1.0, [[
@@ -44,7 +44,7 @@ test:do_execsql_test(1.2, [[
   WITH x(a) AS ( SELECT * FROM t1) INSERT INTO t1 VALUES(1,1,2);
 ]], {
   -- <1.2>
-  
+
   -- </1.2>
 })
 
@@ -52,7 +52,7 @@ test:do_execsql_test(1.3, [[
   WITH x(a) AS ( SELECT * FROM t1) DELETE FROM t1;
 ]], {
   -- <1.3>
-  
+
   -- </1.3>
 })
 
@@ -60,7 +60,7 @@ test:do_execsql_test(1.4, [[
   WITH x(a) AS ( SELECT * FROM t1) UPDATE t1 SET x = y;
 ]], {
   -- <1.4>
-  
+
   -- </1.4>
 })
 
@@ -470,7 +470,7 @@ test:do_execsql_test(7.2, [[
     SELECT i, '' FROM tree WHERE p IS NULL
     UNION ALL
     SELECT i, path || '/' || CAST(i as TEXT) FROM tree, t WHERE p = id
-  ) 
+  )
   SELECT path FROM t;
 ]], {
   -- <7.2>
@@ -483,7 +483,7 @@ test:do_execsql_test(7.3, [[
     VALUES(2)
     UNION ALL
     SELECT i FROM tree, t WHERE p = id
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.3>
@@ -496,7 +496,7 @@ test:do_catchsql_test(7.4, [[
     VALUES(2)
     UNION ALL
     SELECT i FROM tree WHERE p IN (SELECT id FROM t)
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.4>
@@ -509,7 +509,7 @@ test:do_catchsql_test(7.5, [[
     VALUES(2)
     UNION ALL
     SELECT i FROM tree, t WHERE p = id AND p IN (SELECT id FROM t)
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.5>
@@ -522,7 +522,7 @@ test:do_catchsql_test(7.6, [[
     SELECT i FROM tree WHERE 2 IN (SELECT id FROM t)
     UNION ALL
     SELECT i FROM tree, t WHERE p = id
-  ) 
+  )
   SELECT id FROM t;
 ]], {
   -- <7.6>
@@ -539,7 +539,7 @@ test:do_execsql_test("8.1-mandelbrot", [[
     m(iter, cx, cy, x, y) AS (
       SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
       UNION ALL
-      SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m 
+      SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m
        WHERE (x*x + y*y) < 4.0 AND iter<28
     ),
     m2(iter, cx, cy) AS (
@@ -702,7 +702,7 @@ limit_test(9.7, 40, -1)
 --   )
 --   SELECT p FROM flat ORDER BY p;
 -- } {
---   /a /a/a /a/a/a 
+--   /a /a/a /a/a/a
 --      /a/b /a/b/c /a/b/c/d
 --           /a/b/d
 -- }
@@ -712,10 +712,10 @@ limit_test(9.7, 40, -1)
 -- proc scan_tree {bDepthFirst bReverse} {
 --   set order "ORDER BY "
 --   if {$bDepthFirst==0} { append order "2 ASC," }
---   if {$bReverse==0} { 
---     append order " 3 ASC" 
+--   if {$bReverse==0} {
+--     append order " 3 ASC"
 --   } else {
---     append order " 3 DESC" 
+--     append order " 3 DESC"
 --   }
 --   db eval "
 --     WITH flat(fid, depth, p) AS (
@@ -750,7 +750,7 @@ limit_test(9.7, 40, -1)
 --   scan_tree 1 0
 -- } [list {*}{
 --   /a /a/b /a/b/c
---      /a/d /a/d/e 
+--      /a/d /a/d/e
 --           /a/d/f
 --   /g /g/h
 -- }]
@@ -759,9 +759,9 @@ limit_test(9.7, 40, -1)
 -- do_test 10.5 {
 --   scan_tree 0 1
 -- } [list {*}{
---   /g /a 
---   /g/h /a/d /a/b 
---   /a/d/f /a/d/e /a/b/c 
+--   /g /a
+--   /g/h /a/d /a/b
+--   /a/d/f /a/d/e /a/b/c
 -- }]
 -- # Depth first, siblings in ascending order.
 -- #
@@ -769,8 +769,8 @@ limit_test(9.7, 40, -1)
 --   scan_tree 1 1
 -- } [list {*}{
 --   /g /g/h
---   /a /a/d /a/d/f 
---           /a/d/e 
+--   /a /a/d /a/d/f
+--           /a/d/e
 --      /a/b /a/b/c
 -- }]
 -- Test name resolution in ORDER BY clauses.
@@ -778,7 +778,7 @@ limit_test(9.7, 40, -1)
 test:do_catchsql_test("10.7.1", [[
   WITH t(a) AS (
     SELECT 1 AS b UNION ALL SELECT a+1 AS c FROM t WHERE a<5 ORDER BY a
-  ) 
+  )
   SELECT * FROM t
 ]], {
   -- <10.7.1>
@@ -789,7 +789,7 @@ test:do_catchsql_test("10.7.1", [[
 test:do_execsql_test("10.7.2", [[
   WITH t(a) AS (
     SELECT 1 AS b UNION ALL SELECT a+1 AS c FROM t WHERE a<5 ORDER BY b
-  ) 
+  )
   SELECT * FROM t
 ]], {
   -- <10.7.2>
@@ -824,7 +824,7 @@ test:do_execsql_test("10.7.2", [[
 -- }
 -- do_execsql_test 10.8.2 {
 --   WITH flat(fid, depth, p) AS (
---       SELECT id, 1, ('/' || payload) COLLATE nocase 
+--       SELECT id, 1, ('/' || payload) COLLATE nocase
 --       FROM tree WHERE parentid IS NULL
 --     UNION ALL
 --       SELECT id, depth+1, (p||'/'||payload)
@@ -841,7 +841,7 @@ test:do_execsql_test("10.7.2", [[
 --       SELECT id, 1, ('/' || payload)
 --       FROM tree WHERE parentid IS NULL
 --     UNION ALL
---       SELECT id, depth+1, (p||'/'||payload) COLLATE nocase 
+--       SELECT id, depth+1, (p||'/'||payload) COLLATE nocase
 --       FROM flat, tree WHERE parentid=fid
 --     ORDER BY 2, 3
 --   )
@@ -909,7 +909,7 @@ test:do_execsql_test("10.8.4.3", [[
 --   INSERT INTO org VALUES('Xia','Xaviar');
 --   INSERT INTO org VALUES('Xerxes','Xaviar');
 --   INSERT INTO org VALUES('Xena','Xia');
---   -- Find all members of Alice's group, breath-first order  
+--   -- Find all members of Alice's group, breath-first order
 --   WITH RECURSIVE
 --     under_alice(name,level) AS (
 --        VALUES('Alice','0')
@@ -997,7 +997,7 @@ test:do_execsql_test("10.8.4.3", [[
 -- .........Olivia}}
 ----------------------------------------------------------------------------
 -- Ticket [31a19d11b97088296ac104aaff113a9790394927] (2014-02-09)
--- Name resolution issue with compound SELECTs and Common Table Expressions 
+-- Name resolution issue with compound SELECTs and Common Table Expressions
 --
 test:do_execsql_test(12.1, [[
   WITH RECURSIVE
@@ -1046,7 +1046,7 @@ test:do_execsql_test(14.1, [[
   WITH x AS (SELECT * FROM t) SELECT 0 EXCEPT SELECT 0 ORDER BY 1;
 ]], {
   -- <14.1>
-  
+
   -- </14.1>
 })
 
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index c16efac4d..5951765e8 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -85,7 +85,7 @@ test:do_execsql_test(
         WITH x1 AS (SELECT a FROM t1),
              x2 AS (SELECT i FROM t2),
              x3 AS (SELECT * FROM x1, x2 WHERE x1.a IN x2 AND x2.i IN x1)
-        SELECT * FROM x3 
+        SELECT * FROM x3
     ]], {
         -- <1.5>
         2, 2
@@ -137,10 +137,10 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.11,
     [[
-        WITH 
-        i(x) AS ( 
-          WITH 
-          j(x) AS ( SELECT * FROM i ), 
+        WITH
+        i(x) AS (
+          WITH
+          j(x) AS ( SELECT * FROM i ),
           i(x) AS ( SELECT * FROM t1 )
           SELECT * FROM j
         )
@@ -191,10 +191,10 @@ test:do_execsql_test(
 test:do_execsql_test(
     1.14,
     [[
-        WITH 
-        t4(x) AS ( 
+        WITH
+        t4(x) AS (
           VALUES(4)
-          UNION ALL 
+          UNION ALL
           SELECT x+1 FROM t4 WHERE x<10
         )
         SELECT * FROM t4;
@@ -205,10 +205,10 @@ test:do_execsql_test(
     })
 
 test:do_catchsql_test(1.16, [[
-    WITH 
-    t4(x) AS ( 
+    WITH
+    t4(x) AS (
       VALUES(4)
-      UNION ALL 
+      UNION ALL
       SELECT x+1 FROM t4, t4, t4 WHERE x<10
     )
     SELECT * FROM t4;
@@ -262,7 +262,7 @@ test:do_catchsql_test(3.1, [[
 })
 
 test:do_catchsql_test(3.2, [[
-    WITH 
+    WITH
     i(x) AS ( SELECT * FROM j ),
     j(x) AS ( SELECT * FROM k ),
     k(x) AS ( SELECT * FROM i )
@@ -274,7 +274,7 @@ test:do_catchsql_test(3.2, [[
 })
 
 test:do_catchsql_test(3.3, [[
-    WITH 
+    WITH
     i(x) AS ( SELECT * FROM (SELECT * FROM j) ),
     j(x) AS ( SELECT * FROM (SELECT * FROM i) )
     SELECT * FROM i;
@@ -285,7 +285,7 @@ test:do_catchsql_test(3.3, [[
 })
 
 test:do_catchsql_test(3.4, [[
-    WITH 
+    WITH
     i(x) AS ( SELECT * FROM (SELECT * FROM j) ),
     j(x) AS ( SELECT * FROM (SELECT * FROM i) )
     SELECT * FROM j;
@@ -296,8 +296,8 @@ test:do_catchsql_test(3.4, [[
 })
 
 test:do_catchsql_test(3.5, [[
-    WITH 
-    i(x) AS ( 
+    WITH
+    i(x) AS (
       WITH j(x) AS ( SELECT * FROM i )
       SELECT * FROM j
     )
@@ -613,10 +613,10 @@ test:do_execsql_test(
         CREATE TABLE t6(y INTEGER PRIMARY KEY);
 
         WITH s(x) AS ( VALUES(7) UNION ALL SELECT x+7 FROM s WHERE x<49 )
-        INSERT INTO t5 
+        INSERT INTO t5
         SELECT * FROM s;
 
-        INSERT INTO t6 
+        INSERT INTO t6
         WITH s(x) AS ( VALUES(2) UNION ALL SELECT x+2 FROM s WHERE x<49 )
         SELECT * FROM s;
     ]])
@@ -667,7 +667,7 @@ test:do_execsql_test(
     })
 
 ---------------------------------------------------------------------------
--- At one point the following was causing an assertion failure and a 
+-- At one point the following was causing an assertion failure and a
 -- memory leak.
 --
 test:do_execsql_test(
@@ -683,7 +683,7 @@ test:do_execsql_test(
     [[
         WITH q(a) AS (
           SELECT 1
-          UNION 
+          UNION
           SELECT a+1 FROM q, v WHERE a<5
         )
         SELECT * FROM q;
-- 
2.25.1



More information about the Tarantool-patches mailing list