OLD | NEW |
1 # 2014-08-24 | 1 # 2014-08-24 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 WITH RECURSIVE | 69 WITH RECURSIVE |
70 c(x COLLATE binary) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<5) | 70 c(x COLLATE binary) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<5) |
71 SELECT x FROM c; | 71 SELECT x FROM c; |
72 } {1 {syntax error after column name "x"}} | 72 } {1 {syntax error after column name "x"}} |
73 do_catchsql_test parser1-2.2 { | 73 do_catchsql_test parser1-2.2 { |
74 WITH RECURSIVE | 74 WITH RECURSIVE |
75 c(x ASC) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<5) | 75 c(x ASC) AS (VALUES(1) UNION SELECT x+1 FROM c WHERE x<5) |
76 SELECT x FROM c; | 76 SELECT x FROM c; |
77 } {1 {syntax error after column name "x"}} | 77 } {1 {syntax error after column name "x"}} |
78 | 78 |
| 79 # Verify that the comma between multiple table constraints is |
| 80 # optional. |
| 81 # |
| 82 # The missing comma is technically a syntax error. But we have to support |
| 83 # it because there might be legacy databases that omit the commas in their |
| 84 # sqlite_master tables. |
| 85 # |
| 86 do_execsql_test parser1-3.1 { |
| 87 CREATE TABLE t300(id INTEGER PRIMARY KEY); |
| 88 CREATE TABLE t301( |
| 89 id INTEGER PRIMARY KEY, |
| 90 c1 INTEGER NOT NULL, |
| 91 c2 INTEGER NOT NULL, |
| 92 c3 BOOLEAN NOT NULL DEFAULT 0, |
| 93 FOREIGN KEY(c1) REFERENCES t300(id) ON DELETE CASCADE ON UPDATE RESTRICT |
| 94 /* no comma */ |
| 95 FOREIGN KEY(c2) REFERENCES t300(id) ON DELETE CASCADE ON UPDATE RESTRICT |
| 96 /* no comma */ |
| 97 UNIQUE(c1, c2) |
| 98 ); |
| 99 PRAGMA foreign_key_list(t301); |
| 100 } {0 0 t300 c2 id RESTRICT CASCADE NONE 1 0 t300 c1 id RESTRICT CASCADE NONE} |
| 101 |
79 finish_test | 102 finish_test |
OLD | NEW |