The following functionally equivalent SQL queries are accepted by Calcite and produce a valid plan
but they may fail if they are executed via the JDBC adapter since not all DBMS allow grouping by constants expressions. Moreover, what works for one may not work for the other.
The GROUP BY TRUE query works in Postgres, and MySQL but fails in Redshift with the following exception:
The GROUP BY 'a' query works in MySQL but fails in Postgres with the following exception:
The GROUP BY constant is similar to GROUP BY () "nothing" but as shown in the discussion below they are not equivalent. There is a nice blog post listing some limitations of various DBMS when it comes to GROUP BY ().