Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Easiest to explain in a test. The test on current master fails, with relevant part of the parsed and unparsed query turning into something like `GROUP BY GROUPING SETS("product_class_id", "brand_name", "product_class_id")`, incorrectly flattening the sub lists of group sets into one long list.
/** Tests that GROUPING SETS parse and unparse properly, especially that they maintain proper precedence * around nested lists. */ @Test public void testGroupByGroupingSets() { final String query = "select \"product_class_id\", \"brand_name\"\n" + "from \"product\"\n" + "group by GROUPING SETS ((\"product_class_id\", \"brand_name\"), (\"product_class_id\"))\n" + "order by 2, 1"; final String expected = "SELECT \"product_class_id\", \"brand_name\"\n" + "FROM \"foodmart\".\"product\"\n" + "GROUP BY GROUPING SETS((\"product_class_id\", \"brand_name\"), (\"product_class_id\"))\n" + "ORDER BY \"brand_name\", \"product_class_id\""; sql(query) .withPostgresql() .ok(expected); }
Attachments
Issue Links
- links to