Return an error if DISTINCT is used with a window-function (.i.e.
"count(DISTINCT <expr>) OVER (...)". FossilOrigin-Name: d59bcc8eea4fcf0ee3c2263d31ee42f9f26c28434d2f0045f2d3329f18791d1c
This commit is contained in:
parent
8f26da6c5b
commit
e33f6e7c91
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Use\sseparate\sopcodes,\sOP_AggValue\sand\sOP_AggInverse,\sfor\sthe\snew\scallbacks\nassociated\swith\sWindow\sFunctions,\sfor\simproved\sreadability\sof\sEXPLAIN\noutput.
|
||||
D 2018-07-05T21:22:57.019
|
||||
C Return\san\serror\sif\sDISTINCT\sis\sused\swith\sa\swindow-function\s(.i.e.\n"count(DISTINCT\s<expr>)\sOVER\s(...)".
|
||||
D 2018-07-06T07:42:42.390
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6
|
||||
@ -484,7 +484,7 @@ F src/os_win.c ac29c25cde4cfb4adacc59cdec4aa45698ca0e29164ea127859585ccd9faa354
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 1bb6a57fa0465296a4d6109a1a64610a0e7adde1f3acf3ef539a9d972908ce8f
|
||||
F src/pager.h c571b064df842ec8f2e90855dead9acf4cbe0d1b2c05afe0ef0d0145f7fd0388
|
||||
F src/parse.y 9b57f1d0d3d7578ab2917e07ff5d8def4b0aac571113dd7b7cb8108e7194d025
|
||||
F src/parse.y 58ea7c7b407d2c635908c45b5f7c4ac1633fd1f13211bb246154501204ff1ac8
|
||||
F src/pcache.c 135ef0bc6fb2e3b7178d49ab5c9176254c8a691832c1bceb1156b2fbdd0869bd
|
||||
F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170
|
||||
F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880
|
||||
@ -584,7 +584,7 @@ F src/where.c 0bcbf9e191ca07f9ea2008aa80e70ded46bcdffd26560c83397da501f00aece6
|
||||
F src/whereInt.h b90ef9b9707ef750eab2a7a080c48fb4900315033274689def32d0cf5a81ebe4
|
||||
F src/wherecode.c 3317f2b083a66d3e65a03edf316ade4ccb0a99c9956273282ebb579b95d4ba96
|
||||
F src/whereexpr.c 571618c67a3eb5ce0f1158c2792c1aee9b4a4a264392fc4fb1b35467f80abf9a
|
||||
F src/window.c 518274012188475ca02fb8444b1752a046c88a1cde6d1fd86a8e824cbb4b80f6
|
||||
F src/window.c 6f58bfcd558a880f1ac3fc32530b665b22e427272ce20f137fd132fd2ba161e4
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
|
||||
@ -1627,7 +1627,7 @@ F test/window3.test 87fb18021903fc4d1659b8b2092aea55d611a9606cfa7272686234e5197c
|
||||
F test/window4.tcl 7cec7e578aa9f78b7265bff8d552cda17a1d8d89f0449d0e74970a527b8846f5
|
||||
F test/window4.test dcd8767869988e0d23d56bc3f8b46ec116de23127b81b5f66fd48d5529072ed1
|
||||
F test/window5.test 8187f46597c90b73e8f96659e893353cbda337479cc582f7a488eab351ba08d3
|
||||
F test/window6.test 601baeb467fb2e877b3ad89f87a098bf9977a6d197e14913b93cdb509de2d7cd
|
||||
F test/window6.test b3a17d3ca14c211859d1947c2f0b238c4a3f0757d771b6fcb6e03129153ea429
|
||||
F test/windowfault.test 97d5fc404308edb579a5a183e294ed874c844ecf01f0a28ba46df3141ebaee1f
|
||||
F test/with1.test 58475190cd8caaeebea8cfeb2a264ec97a0c492b8ffe9ad20cefbb23df462f96
|
||||
F test/with2.test e0030e2f0267a910d6c0e4f46f2dfe941c1cc0d4f659ba69b3597728e7e8f1ab
|
||||
@ -1745,7 +1745,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 c43dd23fb00f7e0b6274de435d8e31f6a4cb74c3e86e8313a5098ff089e27574
|
||||
R f2e41b301a67b8d68998feae87995b75
|
||||
U drh
|
||||
Z 9251af3e39fe07a55b8965f4ce7c14d4
|
||||
P fa6538050938ffeb042fbee31512514d6d3ace514b2a3dfd8365bbeb13f35a78
|
||||
R 905e7bab4836c398b4da7ed05c2ddee2
|
||||
U dan
|
||||
Z 30f785d3f688c11464a096ce2434bfda
|
||||
|
@ -1 +1 @@
|
||||
fa6538050938ffeb042fbee31512514d6d3ace514b2a3dfd8365bbeb13f35a78
|
||||
d59bcc8eea4fcf0ee3c2263d31ee42f9f26c28434d2f0045f2d3329f18791d1c
|
@ -1028,10 +1028,10 @@ expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP
|
||||
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
|
||||
}
|
||||
A = sqlite3ExprFunction(pParse, Y, &X);
|
||||
sqlite3WindowAttach(pParse, A, Z);
|
||||
if( D==SF_Distinct && A ){
|
||||
A->flags |= EP_Distinct;
|
||||
}
|
||||
sqlite3WindowAttach(pParse, A, Z);
|
||||
}
|
||||
expr(A) ::= id(X) LP STAR RP
|
||||
%ifndef SQLITE_OMIT_WINDOWFUNC
|
||||
|
@ -867,8 +867,13 @@ Window *sqlite3WindowAlloc(
|
||||
*/
|
||||
void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
|
||||
if( p ){
|
||||
p->pWin = pWin;
|
||||
if( pWin ) pWin->pOwner = p;
|
||||
if( pWin ){
|
||||
p->pWin = pWin;
|
||||
pWin->pOwner = p;
|
||||
if( p->flags & EP_Distinct ){
|
||||
sqlite3ErrorMsg(pParse,"DISTINCT is not supported for window functions");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sqlite3WindowDelete(pParse->db, pWin);
|
||||
}
|
||||
|
@ -222,11 +222,17 @@ do_catchsql_test 9.1 {
|
||||
SELECT x, group_concat(x) OVER (ORDER BY x RANGE 2 PRECEDING)
|
||||
FROM c;
|
||||
} {1 {RANGE PRECEDING is only supported with UNBOUNDED}}
|
||||
|
||||
do_catchsql_test 9.2 {
|
||||
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<5)
|
||||
SELECT x, group_concat(x) OVER (ORDER BY x RANGE BETWEEN UNBOUNDED PRECEDING AND 2 FOLLOWING)
|
||||
FROM c;
|
||||
} {1 {RANGE FOLLOWING is only supported with UNBOUNDED}}
|
||||
|
||||
do_catchsql_test 9.3 {
|
||||
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<5)
|
||||
SELECT count(DISTINCT x) OVER (ORDER BY x) FROM c;
|
||||
} {1 {DISTINCT is not supported for window functions}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user