Skip to content

Commit 1e3435f

Browse files
committed
fix: stringify having.
1 parent ff9b7ce commit 1e3435f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-sql-parser",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "",
55
"main": "./dist/parser/sqlParser.js",
66
"scripts": {

‎src/stringify.js

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Sql.prototype.travelSelect = function(ast) {
107107
this.travel(ast.groupBy);
108108
}
109109
if (ast.having) {
110+
this.appendKeyword('having');
110111
this.travel(ast.having);
111112
}
112113
if (ast.orderBy) {

‎test/main.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -377,5 +377,9 @@ describe('select grammar support', function () {
377377
testParser('select a from dual order by a desc limit 1, 1 union distinct select a from foo order by a limit 1');
378378
});
379379

380+
it ('fix having', function () {
381+
testParser('select a, count(*) cnt from b group by a having count(*) > 1;');
382+
});
383+
380384
});
381385

0 commit comments

Comments
 (0)