Enhances the parser so that it accepts arbitrary expressions for the arguments

of an index, though the code generator still rejects everything other than
simple column names.  The sqlite3RestrictColumnListSyntax() routine is removed
since that feature is now handled by the parser.

FossilOrigin-Name: bed42116addabcf3dfdc2e2d51ae183965704988
This commit is contained in:
drh
2015-08-24 20:21:20 +00:00
parent 8981b904b5
commit 108aa00a87
8 changed files with 135 additions and 95 deletions
+22 -1
View File
@@ -21,7 +21,13 @@ do_catchsql_test parser1-1.1 {
b TEXT,
FOREIGN KEY(b COLLATE nocase DESC) REFERENCES t1(a COLLATE binary ASC)
);
} {1 {syntax error after column name "a"}}
} {1 {syntax error after column name "b"}}
# Verify that a legacy schema in the sqlite_master file is allowed to have
# COLLATE, ASC, and DESC keywords on the id list of a FK constraint, and that
# those keywords are silently ignored.
#
do_execsql_test parser1-1.2 {
CREATE TABLE t1(
a TEXT PRIMARY KEY,
@@ -42,7 +48,22 @@ do_test parser1-1.3 {
sqlite3 db2 test.db
db2 eval {SELECT * FROM t1 ORDER BY 1}
} {abc {} xyz abc}
db2 close
do_execsql_test parser1-1.4 {
UPDATE sqlite_master SET sql='CREATE TABLE t1(
a TEXT PRIMARY KEY,
b TEXT,
FOREIGN KEY(b ASC) REFERENCES t1(a)
)' WHERE name='t1';
SELECT name FROM sqlite_master WHERE sql LIKE '%ASC%';
} {t1}
sqlite3 db2 test.db
do_test parser1-1.5 {
sqlite3 db2 test.db
db2 eval {SELECT * FROM t1 ORDER BY 1}
} {abc {} xyz abc}
db2 close
do_catchsql_test parser1-2.1 {
WITH RECURSIVE