chore: make every CREATE TABLE stmt in entire repo have 1 space after tbl name

`BTreeTable::to_sql` makes us incompatible with SQLite by losing e.g. the original whitespace provided during the CREATE TABLE command.

For now let's fix our tests by regex-replacing every CREATE TABLE in
the entire repo to have exactly 1 space after the table name in the
CREATE TABLE statement.
This commit is contained in:
Jussi Saurio
2025-07-22 11:33:49 +03:00
parent f83870731d
commit 022f679fab
59 changed files with 666 additions and 661 deletions

View File

@@ -35,10 +35,10 @@ proc xferopt_test {testname N} {
#
sqlite3_db_config db LEGACY_FILE_FORMAT 0
execsql {
CREATE TABLE t1(a int, b int, check(b>a));
CREATE TABLE t2(x int, y int);
CREATE TABLE t1 (a int, b int, check(b>a));
CREATE TABLE t2 (x int, y int);
CREATE VIEW v2 AS SELECT y, x FROM t2;
CREATE TABLE t3(a int, b int);
CREATE TABLE t3 (a int, b int);
}
# Ticket #2252. Make sure the an INSERT from identical tables
@@ -136,8 +136,8 @@ xferopt_test insert4-2.4.4 0
# the destination and source tables.
#
proc xfer_check {testid xferused initdata destschema srcschema} {
execsql "CREATE TABLE dest($destschema)"
execsql "CREATE TABLE src($srcschema)"
execsql "CREATE TABLE dest ($destschema)"
execsql "CREATE TABLE src ($srcschema)"
execsql "INSERT INTO src VALUES([join $initdata ,])"
set ::sqlite3_xferopt_count 0
do_test $testid.1 {
@@ -236,7 +236,7 @@ xfer_check insert4-3.22 1 {1 9} \
#
do_test insert4-4.1a {
execsql {CREATE TABLE t4(a, b, UNIQUE(a,b))}
execsql {CREATE TABLE t4 (a, b, UNIQUE(a,b))}
} {}
ifcapable vacuum {
do_test insert4-4.1b {
@@ -258,7 +258,7 @@ do_test insert4-5.1 {
do_test insert4-5.2 {
# Number of columns does not match.
catchsql {
CREATE TABLE t5(a, b, c);
CREATE TABLE t5 (a, b, c);
INSERT INTO t4 SELECT * FROM t5;
}
} {1 {table t4 has 2 columns but 3 values were supplied}}
@@ -303,14 +303,14 @@ do_test insert4-6.4 {
do_test insert4-6.5 {
execsql {
CREATE TABLE t6a(x CHECK( x<>'abc' ));
CREATE TABLE t6a (x CHECK( x<>'abc' ));
INSERT INTO t6a VALUES('ABC');
SELECT * FROM t6a;
}
} {ABC}
do_test insert4-6.6 {
execsql {
CREATE TABLE t6b(x CHECK( x<>'abc' COLLATE nocase ));
CREATE TABLE t6b (x CHECK( x<>'abc' COLLATE nocase ));
}
catchsql {
INSERT INTO t6b SELECT * FROM t6a;
@@ -319,7 +319,7 @@ do_test insert4-6.6 {
do_test insert4-6.7 {
execsql {
DROP TABLE t6b;
CREATE TABLE t6b(x CHECK( x COLLATE nocase <>'abc' ));
CREATE TABLE t6b (x CHECK( x COLLATE nocase <>'abc' ));
}
catchsql {
INSERT INTO t6b SELECT * FROM t6a;
@@ -334,9 +334,9 @@ ifcapable foreignkey {
do_test insert4-7.1 {
set ::sqlite3_xferopt_count 0
execsql {
CREATE TABLE t7a(x INTEGER PRIMARY KEY); INSERT INTO t7a VALUES(123);
CREATE TABLE t7b(y INTEGER REFERENCES t7a);
CREATE TABLE t7c(z INT); INSERT INTO t7c VALUES(234);
CREATE TABLE t7a (x INTEGER PRIMARY KEY); INSERT INTO t7a VALUES(123);
CREATE TABLE t7b (y INTEGER REFERENCES t7a);
CREATE TABLE t7c (z INT); INSERT INTO t7c VALUES(234);
INSERT INTO t7b SELECT * FROM t7c;
SELECT * FROM t7b;
}
@@ -394,8 +394,8 @@ do_test insert4-8.1 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT REPLACE, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT REPLACE, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
@@ -406,8 +406,8 @@ do_test insert4-8.2 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2(x, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2 (x, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
@@ -418,8 +418,8 @@ do_test insert4-8.3 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT IGNORE, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT IGNORE, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
@@ -430,8 +430,8 @@ do_test insert4-8.4 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2(x, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2 (x, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
@@ -442,8 +442,8 @@ do_test insert4-8.5 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT FAIL, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT FAIL, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT FAIL, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT FAIL, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(-99,100);
INSERT INTO t2 VALUES(1,3);
@@ -462,8 +462,8 @@ do_test insert4-8.7 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT ABORT, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ABORT, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT ABORT, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT ABORT, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(-99,100);
INSERT INTO t2 VALUES(1,3);
@@ -482,8 +482,8 @@ do_test insert4-8.9 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, y);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(-99,100);
INSERT INTO t2 VALUES(1,3);
@@ -508,8 +508,8 @@ do_test insert4-8.21 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT REPLACE, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT REPLACE, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT REPLACE, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
@@ -519,8 +519,8 @@ do_test insert4-8.22 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT IGNORE, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT IGNORE, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT IGNORE, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
@@ -530,8 +530,8 @@ do_test insert4-8.23 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT ABORT, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ABORT, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT ABORT, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT ABORT, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
@@ -541,8 +541,8 @@ do_test insert4-8.24 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT FAIL, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT FAIL, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT FAIL, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT FAIL, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
@@ -552,8 +552,8 @@ do_test insert4-8.25 {
execsql {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(a INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, b);
CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, y);
CREATE TABLE t1 (a INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, b);
CREATE TABLE t2 (x INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, y);
INSERT INTO t2 VALUES(1,3);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
@@ -562,7 +562,7 @@ do_test insert4-8.25 {
do_catchsql_test insert4-9.1 {
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(x);
CREATE TABLE t1 (x);
INSERT INTO t1(x) VALUES(5 COLLATE xyzzy) UNION SELECT 0;
} {1 {no such collation sequence: xyzzy}}
@@ -571,7 +571,7 @@ do_catchsql_test insert4-9.1 {
# optimization for tables with CHECK constraints.
#
do_execsql_test 10.1 {
CREATE TABLE t8(
CREATE TABLE t8 (
rid INTEGER,
pid INTEGER,
mid INTEGER,
@@ -608,7 +608,7 @@ do_test 10.4 {
# xfer transfer between tables where the source has an empty partial index.
#
do_execsql_test 11.0 {
CREATE TABLE t9(a, b, c);
CREATE TABLE t9 (a, b, c);
CREATE INDEX t9a ON t9(a);
CREATE INDEX t9b ON t9(b) WHERE c=0;
@@ -616,7 +616,7 @@ do_execsql_test 11.0 {
INSERT INTO t9 VALUES(2, 2, 2);
INSERT INTO t9 VALUES(3, 3, 3);
CREATE TABLE t10(a, b, c);
CREATE TABLE t10 (a, b, c);
CREATE INDEX t10a ON t10(a);
CREATE INDEX t10b ON t10(b) WHERE c=0;