Skip to content

Commit 467cbd7

Browse files
committed
fix: empty nested filters
Signed-off-by: Ruben Nogueira <40404708+rubnogueira@users.noreply.github.com>
1 parent 9a6d551 commit 467cbd7

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

lib/sql.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,13 @@ SQLConnector.prototype._buildWhere = function(model, where) {
11311131
branches.push(stmtForClause.sql);
11321132
}
11331133
}
1134-
stmt.merge({
1135-
sql: '(' + branches.join(' ' + key.toUpperCase() + ' ') + ')',
1136-
params: branchParams,
1137-
});
1138-
whereStmts.push(stmt);
1134+
if (branches.length > 0) {
1135+
stmt.merge({
1136+
sql: '(' + branches.join(' ' + key.toUpperCase() + ' ') + ')',
1137+
params: branchParams,
1138+
});
1139+
whereStmts.push(stmt);
1140+
}
11391141
continue;
11401142
}
11411143
// The value is not an array, fall back to regular fields

0 commit comments

Comments
 (0)