Skip to content

Commit d9cf918

Browse files
committed
fix: having & remove incorrect import.
1 parent 9e61282 commit d9cf918

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
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.0.8",
3+
"version": "1.0.9",
44
"description": "",
55
"main": "./dist/parser/sqlParser.js",
66
"scripts": {

‎src/stringify.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { timingSafeEqual } from "crypto";
2-
31
if (!sqlParser) {
42
sqlParser = {};
53
}
@@ -109,6 +107,7 @@ Sql.prototype.travelSelect = function(ast) {
109107
this.travel(ast.groupBy);
110108
}
111109
if (ast.having) {
110+
this.appendKeyword('having');
112111
this.travel(ast.having);
113112
}
114113
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 ('bugfix: 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)