Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ failure rather than as a silent divergence.
| `tokenize.c` | `src/tokenize.c` |
| `mkkeywordhash.c` | `tool/mkkeywordhash.c` |

Both come from SQLite 3.53.4, the release pinned in
Both come from SQLite 3.54.1, the release pinned in
`cmd/regenerate-parse/main.go` and recorded in
`parser/testdata/README.md`. When the pin advances, replace them.

Expand Down
14 changes: 12 additions & 2 deletions internal/reference/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ seltablist(A) ::= stl_prefix(A) nm(Y) dbnm(D) LP exprlist(E) RP as(Z) on_using(N
SrcItem *pOld = F->a;
assert( pOld->fg.fixedSchema==0 );
pNew->zName = pOld->zName;
pOld->zName = 0;
assert( pOld->fg.fixedSchema==0 );
if( pOld->fg.isSubquery ){
pNew->fg.isSubquery = 1;
Expand All @@ -803,8 +804,13 @@ seltablist(A) ::= stl_prefix(A) nm(Y) dbnm(D) LP exprlist(E) RP as(Z) on_using(N
pOld->u1.pFuncArg = 0;
pOld->fg.isTabFunc = 0;
pNew->fg.isTabFunc = 1;
}else if( pOld->fg.isIndexedBy ){
pNew->u1.zIndexedBy = pOld->u1.zIndexedBy;
pOld->u1.zIndexedBy = 0;
pOld->fg.isIndexedBy = 0;
pNew->fg.isIndexedBy = 1;
}
pOld->zName = 0;
pNew->fg.notIndexed = pOld->fg.notIndexed;
}
sqlite3SrcListDelete(pParse->db, F);
}else{
Expand Down Expand Up @@ -1512,7 +1518,11 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
}
}else{
Expr *pRHS = Y->a[0].pExpr;
if( Y->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && A->op!=TK_VECTOR ){
if( Y->nExpr==1
&& sqlite3ExprIsConstant(pParse,pRHS)
&& pRHS->op!=TK_COLLATE
&& A->op!=TK_VECTOR
){
Y->a[0].pExpr = 0;
sqlite3ExprListDelete(pParse->db, Y);
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
Expand Down
6 changes: 3 additions & 3 deletions internal/sqlitesrc/sqlitesrc.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ var oracleSource []byte
// constants and parser/testdata/README.md, regenerate the corpus, and
// review the diff.
const (
Version = "3530400" // 3.53.4
Version = "3540100" // 3.54.1
year = "2026"
amalgamationSHA = "1e71ddf93849c6a6ecf58b827c0692073d2dd7ee40196158068f7b29f422e87d"
srcSHA = "d18fa15aec74d8c17e1463f861095adc01b5ad190256acb4f91d22f0368d232b"
amalgamationSHA = "0a9c8e34352dad46006aa82836d5383bff9dc6bc9ce5a60553c05aa30e6ad1f9"
srcSHA = "387e7f6cad4797b17848c07d453dc6606917bb356a6cfe5a3abafd38c240c71b"
)

// Oracle returns the path to the compiled oracle binary, downloading the
Expand Down
4 changes: 2 additions & 2 deletions parser/testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ own goldens; they never outrank the accept/reject corpus below.

| artifact | file | SHA-256 |
|---|---|---|
| SQLite 3.53.4 amalgamation | `https://sqlite.org/2026/sqlite-amalgamation-3530400.zip` | `1e71ddf93849c6a6ecf58b827c0692073d2dd7ee40196158068f7b29f422e87d` |
| SQLite 3.53.4 source | `https://sqlite.org/2026/sqlite-src-3530400.zip` | `d18fa15aec74d8c17e1463f861095adc01b5ad190256acb4f91d22f0368d232b` |
| SQLite 3.54.1 amalgamation | `https://sqlite.org/2026/sqlite-amalgamation-3540100.zip` | `0a9c8e34352dad46006aa82836d5383bff9dc6bc9ce5a60553c05aa30e6ad1f9` |
| SQLite 3.54.1 source | `https://sqlite.org/2026/sqlite-src-3540100.zip` | `387e7f6cad4797b17848c07d453dc6606917bb356a6cfe5a3abafd38c240c71b` |

## License

Expand Down
38 changes: 38 additions & 0 deletions parser/testdata/aggnested.test
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,41 @@ stmt 81 err 1 -1 110 no such table: t0
stmt 110 ok
stmt 137 err 1 -1 166 no such table: t1
stmt 166 err 1 -1 325 no such table: t0
==== 11.1

DROP TABLE t1;
CREATE TABLE t1(c1); INSERT INTO t1 VALUES(11);
DROP TABLE t2;
CREATE TABLE t2(c2);
----
stmt 0 err 1 -1 17 no such table: t1
stmt 17 ok
stmt 40 err 1 -1 67 no such table: t1
stmt 67 err 1 -1 84 no such table: t2
stmt 84 ok
==== 11.2

SELECT * FROM t1 WHERE EXISTS(
SELECT 1 FROM t2 WHERE (
SELECT COUNT(*) FROM (
SELECT 1
UNION ALL
SELECT SUM(c1)
)
)
);
----
stmt 0 err 1 -1 168 no such table: t1
==== 11.3

SELECT * FROM t1 WHERE EXISTS(
SELECT 1 FROM t2 WHERE (
SELECT COUNT(*) FROM (
SELECT 1 WHERE true
UNION ALL
SELECT SUM(c1)
)
)
);
----
stmt 0 err 1 -1 179 no such table: t1
21 changes: 21 additions & 0 deletions parser/testdata/aggorderby.test
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,24 @@ stmt 0 ok
----
stmt 0 ok
stmt 25 err 1 -1 56 no such table: t1
==== 11.0

CREATE TABLE t1(a);
CREATE TABLE t2(b);
INSERT INTO t1 VALUES(42);
INSERT INTO t2 VALUES(2);
----
stmt 0 ok
stmt 22 ok
stmt 44 err 1 -1 73 no such table: t1
stmt 73 err 1 -1 101 no such table: t2
==== 11.1

SELECT sum(b ORDER BY a) FROM t1, t2;
----
stmt 0 err 1 -1 40 no such table: t1
==== 11.2

SELECT group_concat(b ORDER BY a) FROM t1, t2;
----
stmt 0 err 1 -1 49 no such table: t1
10 changes: 10 additions & 0 deletions parser/testdata/alter.test
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,13 @@ stmt 179 err 1 -1 210 no such table: e
SELECT name, type FROM sqlite_schema ORDER BY name;
----
stmt 0 ok
==== alter-22.1

CREATE TABLE t1(a,b);
----
stmt 0 ok
==== alter-22.2

ALTER TABLE t1 ADD COLUMN c CHECK( if(c<10,1,sqlite_fail('bummer',1)));
----
stmt 0 err 1 -1 36 no such table: t1
38 changes: 38 additions & 0 deletions parser/testdata/altercons.test
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,41 @@ stmt 0 err 1 -1 92 no such table: t1
ALTER TABLE t1 ADD CONSTRAINT c1 CHECK( x>#2 );
----
stmt 0 err 1 45 49 near "#2": syntax error
==== 11.1

CREATE TABLE t1(a, b, c);
INSERT INTO t1 VALUES(1, 2, 3);
INSERT INTO t1 VALUES(4, NULL, 6);
INSERT INTO t1 VALUES(NULL, NULL, NULL);
----
stmt 0 ok
stmt 28 err 1 -1 62 no such table: t1
stmt 62 err 1 -1 99 no such table: t1
stmt 99 err 1 -1 142 no such table: t1
==== 11.3

SELECT sql FROM sqlite_schema WHERE name='t1';
----
stmt 0 ok
==== 11.3.1

ALTER TABLE t1 ADD CONSTRAINT c5 CHECK (b>2);
----
stmt 0 err 1 -1 48 no such table: t1
==== 11.3.2

UPDATE t1 SET b=NULL WHERE b=2;
ALTER TABLE t1 ADD CONSTRAINT c5 CHECK (b>2);
----
stmt 0 err 1 -1 34 no such table: t1
stmt 34 err 1 -1 82 no such table: t1
==== 11.4.1

INSERT INTO t1 VALUES(7, NULL, 8);
----
stmt 0 err 1 -1 37 no such table: t1
==== 11.4.2

INSERT INTO t1 VALUES(5, 1, 0);
----
stmt 0 err 1 -1 34 no such table: t1
5 changes: 5 additions & 0 deletions parser/testdata/altercons2.test
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ stmt 0 ok
ALTER TABLE abc DROP CONSTRAINT one
----
stmt 0 err 1 -1 39 no such table: abc
==== 8.2

SELECT sql FROM sqlite_schema
----
stmt 0 ok
==== 9.0

CREATE TABLE abc(a, b NOT NULL AS (a+1))
Expand Down
1 change: 1 addition & 0 deletions parser/testdata/altercons3.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
74 changes: 74 additions & 0 deletions parser/testdata/altercons3.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
==== 1.0

CREATE TABLE p1(a PRIMARY KEY);
CREATE TABLE c1(b CONSTRAINT fk REFERENCES p1(a));
----
stmt 0 ok
stmt 34 ok
==== 1.1

ALTER TABLE c1 DROP CONSTRAINT fk;
SELECT sql FROM sqlite_schema WHERE name='c1';
----
stmt 0 err 1 -1 37 no such table: c1
stmt 37 ok
==== 2.0

CREATE TABLE p1(a PRIMARY KEY);
CREATE TABLE c1(b, CONSTRAINT fk FOREIGN KEY (b) REFERENCES p1(a));
----
stmt 0 ok
stmt 34 ok
==== 2.1

ALTER TABLE c1 DROP CONSTRAINT fk;
SELECT sql FROM sqlite_schema WHERE name='c1';
----
stmt 0 err 1 -1 37 no such table: c1
stmt 37 ok
==== 3.0

CREATE TABLE generated(a PRIMARY KEY);
CREATE TABLE c1(b CONSTRAINT fk REFERENCES generated(a));
----
stmt 0 ok
stmt 41 ok
==== 3.1

ALTER TABLE c1 DROP CONSTRAINT fk;
SELECT sql FROM sqlite_schema WHERE name='c1';
----
stmt 0 err 1 -1 37 no such table: c1
stmt 37 ok
==== altercons3-generated
DROP TABLE IF EXISTS c1
----
stmt 0 ok
==== altercons3-generated.dup1
ALTER TABLE c1 DROP CONSTRAINT fk
----
stmt 0 err 1 -1 35 no such table: c1
==== altercons3-generated.dup2

SELECT sql FROM sqlite_schema WHERE name='c1'
----
stmt 0 ok
==== 5.0

CREATE TABLE x1(a, b CONSTRAINT ott REFERENCES x2);
PRAGMA writable_schema = 1;
UPDATE sqlite_schema SET sql='CREATE TABLE x1(a, b CONSTRAINT ott REFERENCES';
----
stmt 0 ok
stmt 54 ok
stmt 84 ok
==== 5.1

ALTER TABLE x1 DROP CONSTRAINT ott;
----
stmt 0 err 1 -1 38 no such table: x1
==== 5.2

SELECT sql FROM sqlite_schema
----
stmt 0 ok
18 changes: 18 additions & 0 deletions parser/testdata/altertab3.test
Original file line number Diff line number Diff line change
Expand Up @@ -768,3 +768,21 @@ stmt 0 ok
----
stmt 0 err 1 -1 32 no such table: x1
stmt 32 ok
==== 34.0

CREATE TABLE t1(rowid TEXT, b INTEGER);
CREATE TABLE t2(a TEXT, oid INTEGER);
CREATE TABLE t3(a TEXT, b INTEGER);

CREATE TABLE t4(a TEXT PRIMARY KEY, b INTEGER) WITHOUT ROWID;
CREATE TABLE t5(a INTEGER PRIMARY KEY, rowid INTEGER) WITHOUT ROWID;
CREATE TABLE t6(a INTEGER PRIMARY KEY, oid INTEGER) WITHOUT ROWID;
CREATE TABLE t7(a INTEGER PRIMARY KEY, oid INTEGER) WITHOUT ROWID;
----
stmt 0 ok
stmt 42 ok
stmt 82 ok
stmt 120 ok
stmt 185 ok
stmt 256 ok
stmt 325 ok
74 changes: 74 additions & 0 deletions parser/testdata/amatch1.test
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,77 @@ stmt 0 err 1 -1 83 no such table: t2
WHERE word MATCH 'joxxph' AND distance<300;
----
stmt 0 err 1 -1 83 no such table: t3
==== amatch1-3.0

CREATE TABLE cost(iLang,cFrom,cTo,Cost);
INSERT INTO cost VALUES(0,'?','?',1);
CREATE TABLE vocab(word TEXT PRIMARY KEY);
CREATE VIRTUAL TABLE am USING approximate_match(
vocabulary_table=vocab,
vocabulary_word=word,
edit_distances=cost
);
INSERT INTO vocab(word) VALUES(format('%.81c','a'));
SELECT length(word) FROM am WHERE word MATCH format('%.81c','a');
----
stmt 0 ok
stmt 43 err 1 -1 83 no such table: cost
stmt 83 ok
stmt 128 ok
stmt 268 err 1 -1 323 no such table: vocab
stmt 323 err 1 -1 391 no such table: am
==== amatch1-4.0

CREATE TABLE v(w TEXT, l INT);
INSERT INTO v VALUES('abc',0);
INSERT INTO v VALUES('abd',0);
CREATE TABLE ec(iLang, cFrom, cTo, Cost);
INSERT INTO ec VALUES(0,'?','a',-2000000000);
----
stmt 0 ok
stmt 33 err 1 -1 66 no such table: v
stmt 66 err 1 -1 99 no such table: v
stmt 99 ok
stmt 143 err 1 -1 191 no such table: ec
==== amatch1-4.1

CREATE VIRTUAL TABLE t USING approximate_match(
vocabulary_table=v,
vocabulary_word=w,
edit_distances=ec
);
----
stmt 0 ok
==== amatch1-5.0

CREATE TABLE vocab(w);
INSERT INTO vocab VALUES('abc');
CREATE TABLE costs(a,b,c,d);
INSERT INTO costs VALUES(0,'?','',97),(0,'','?',98);
CREATE VIRTUAL TABLE t USING approximate_match(
vocabulary_table=vocab,
vocabulary_word=w,
edit_distances=costs
);
----
stmt 0 ok
stmt 25 err 1 -1 60 no such table: vocab
stmt 60 ok
stmt 91 err 1 -1 146 no such table: costs
stmt 146 ok
==== amatch1-5.1

SELECT word, distance FROM t WHERE word MATCH 'abc';
----
stmt 0 err 1 -1 55 no such table: t
==== amatch1-5.2

SELECT word, distance FROM t WHERE word MATCH 'abc'
AND distance<9223372036854775807;
----
stmt 0 err 1 -1 121 no such table: t
==== amatch1-5.3

SELECT word, distance FROM t WHERE word MATCH 'abc' AND distance<10;
----
stmt 0 err 1 -1 71 no such table: t
Loading
Loading