diff --git a/pegjs/snowflake.pegjs b/pegjs/snowflake.pegjs index 4de13408..2e79ba96 100644 --- a/pegjs/snowflake.pegjs +++ b/pegjs/snowflake.pegjs @@ -2536,9 +2536,10 @@ where_clause = KW_WHERE __ e:or_and_where_expr { /* => binary_expr */ return e; } group_by_clause - = KW_GROUP __ KW_BY __ e:expr_list { + = KW_GROUP __ KW_BY __ e:(KW_ALL / expr_list) { + const columns = e === 'ALL' ? [{ type: 'origin', value: 'all'}] : e.value return { - columns: e.value + columns } } diff --git a/test/snowflake.spec.js b/test/snowflake.spec.js index c9a7b49a..496614ce 100644 --- a/test/snowflake.spec.js +++ b/test/snowflake.spec.js @@ -242,6 +242,13 @@ describe('snowflake', () => { 'CREATE TABLE "1dog" ("id" INT)' ] }, + { + title: 'group by all', + sql: [ + 'SELECT A, B, COUNT(*) FROM T GROUP BY All', + 'SELECT "A", "B", COUNT(*) FROM "T" GROUP BY ALL' + ] + }, ] SQL_LIST.forEach(sqlInfo => { const { title, sql } = sqlInfo