aboutsummaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2018-07-06 07:42:42 +0000
committerdan <dan@noemail.net>2018-07-06 07:42:42 +0000
commite33f6e7c91d37f8a91a9d11acf2f367d585e1120 (patch)
treeb1ccf7a713a892f285ba0a361f0e2baf2665c228 /src/window.c
parent8f26da6c5b8a5ad164cd9934281a3ab33e68dfd1 (diff)
downloadsqlite-e33f6e7c91d37f8a91a9d11acf2f367d585e1120.tar.gz
sqlite-e33f6e7c91d37f8a91a9d11acf2f367d585e1120.zip
Return an error if DISTINCT is used with a window-function (.i.e.
"count(DISTINCT <expr>) OVER (...)". FossilOrigin-Name: d59bcc8eea4fcf0ee3c2263d31ee42f9f26c28434d2f0045f2d3329f18791d1c
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/window.c b/src/window.c
index 751e17d2a..b31ed156d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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);
}