Skip to content

Commit

Permalink
Fix a problem with renaming tables when the schema contains an invoca…
Browse files Browse the repository at this point in the history
…tion of a currently unregistered aggregate with a FILTER clause.
  • Loading branch information
danielk-1977 committed Jul 22, 2019
1 parent 3feab07 commit b5f1baf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
}
}
#ifndef SQLITE_OMIT_WINDOWFUNC
else if( pWin ){
else if( ExprHasProperty(pExpr, EP_WinFunc) ){
is_agg = 1;
}
#endif
Expand Down
15 changes: 15 additions & 0 deletions test/altertab3.test
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,19 @@ do_execsql_test 13.2 {
ALTER TABLE t1 RENAME TO t1x;
}

#-------------------------------------------------------------------------
reset_db
do_execsql_test 14.1 {
CREATE TABLE t1(a);
CREATE TABLE t2(b);
CREATE TRIGGER AFTER INSERT ON t1 BEGIN
SELECT sum() FILTER (WHERE (SELECT sum() FILTER (WHERE 0)) AND a);
END;
}

do_catchsql_test 14.2 {
ALTER TABLE t1 RENAME TO t1x;
} {1 {error in trigger AFTER: no such column: a}}

finish_test

0 comments on commit b5f1baf

Please sign in to comment.