Add support for table-valued functions on the RHS of an IN operator.

FossilOrigin-Name: ac6000f050ff4efcf8a87f0825077dbf4144f073
This commit is contained in:
drh 2016-07-02 12:08:14 +00:00
parent 7c95696e5c
commit 5fbab882c0
4 changed files with 27 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Fix\sthe\stransitive\sconstraint\slogic\serror\sthat\scan\sresult\sin\sa\snull\spointer\ndereference.\s\sFix\sfor\sticket\s[e8d439c77685eca6].
D 2016-07-01T20:12:39.149
C Add\ssupport\sfor\stable-valued\sfunctions\son\sthe\sRHS\sof\san\sIN\soperator.
D 2016-07-02T12:08:14.436
F Makefile.in bc2b4864a23a4a21c3e26d7b4350f51bab324d45
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 50149765ef72f4e652b9a0f1f6462c4784bb9423
@ -371,7 +371,7 @@ F src/os_win.c d4b8faf8896b65818e67070711fdd00d8e620bd6
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c c368634b888b1c8740aea83b36bfd266f2443e60
F src/pager.h 8ab6b6feeee4bc0439bfde7ee59ba99df98b9bc3
F src/parse.y 01b9f37c4c7009ab56fda98bc7db4c42643cecfe
F src/parse.y 3660ab75e7c9212fbe9ca75264d26e6587cd0ae4
F src/pcache.c 5583c8ade4b05075a60ba953ef471d1c1a9c05df
F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d
@ -1115,7 +1115,7 @@ F test/symlink.test c9ebe7330d228249e447038276bfc8a7b22f4849
F test/sync.test 2f84bdbc2b2df1fcb0220575b4b9f8cea94b7529
F test/syscall.test f59ba4e25f7ba4a4c031026cc2ef8b6e4b4c639c
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
F test/tabfunc01.test f977868fa8bb7beb4b2072883190411653473906
F test/tabfunc01.test bb774639915aaaf30417f8d0faf832c3309a3338
F test/table.test b708f3e5fa2542fa51dfab21fc07b36ea445cb2f
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@ -1503,8 +1503,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f81050859170c8708a1b296da8dd3ef0dd314a11 c952af89c22ddc31491f142b9511608a4c8f9737
R 9c182c2a1bd41d85d1ee54cc469d61e7
T +closed c952af89c22ddc31491f142b9511608a4c8f9737
P 228a7879870f8689e2f9b74fbef2ff93fab7b3c2
R 1f493f554aeef5ddfd3c1d7c325d64e1
U drh
Z 6ff2c1fb4a902fab6eeb4b75477a29a3
Z 647695f7bc7b8a80ecfde87fc6913c51

View File

@ -1 +1 @@
228a7879870f8689e2f9b74fbef2ff93fab7b3c2
ac6000f050ff4efcf8a87f0825077dbf4144f073

View File

@ -1134,9 +1134,10 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
exprNot(pParse, N, &A);
A.zEnd = &E.z[E.n];
}
expr(A) ::= expr(A) in_op(N) nm(Y) dbnm(Z). [IN] {
expr(A) ::= expr(A) in_op(N) nm(Y) dbnm(Z) paren_exprlist(E). [IN] {
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&Y,&Z);
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
if( E ) sqlite3SrcListFuncArgs(pParse, pSrc, E);
A.pExpr = sqlite3PExpr(pParse, TK_IN, A.pExpr, 0, 0);
sqlite3PExprAddSelect(pParse, A.pExpr, pSelect);
exprNot(pParse, N, &A);
@ -1193,6 +1194,14 @@ nexprlist(A) ::= nexprlist(A) COMMA expr(Y).
nexprlist(A) ::= expr(Y).
{A = sqlite3ExprListAppend(pParse,0,Y.pExpr); /*A-overwrites-Y*/}
/* A paren_exprlist is an optional expression list contained inside
** of parenthesis */
%type paren_exprlist {ExprList*}
%destructor paren_exprlist {sqlite3ExprListDelete(pParse->db, $$);}
paren_exprlist(A) ::= . {A = 0;}
paren_exprlist(A) ::= LP exprlist(X) RP. {A = X;}
///////////////////////////// The CREATE INDEX command ///////////////////////
//

View File

@ -135,4 +135,13 @@ do_execsql_test tabfunc01-500 {
ORDER BY +1;
} {1 7 11 17}
# Table-valued functions on the RHS of an IN operator
#
do_execsql_test tabfunc01-600 {
CREATE TABLE t600(a INTEGER PRIMARY KEY, b TEXT);
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
INSERT INTO t600(a,b) SELECT x, printf('(%03d)',x) FROM c;
SELECT b FROM t600 WHERE a IN generate_series(2,52,10);
} {(002) (012) (022) (032) (042) (052)}
finish_test