[Mondrian] Parenthesized queries in UNION

Julian Hyde jhyde at pentaho.com
Tue Dec 4 02:04:06 EST 2012


By the way, this was the commit: https://github.com/pentaho/mondrian/commit/8837434cc059a0023da25288abfe5e9ec21f38fc.

Julian

On Dec 3, 2012, at 10:44 PM, Julian Hyde <jhyde at pentaho.com> wrote:

> Tiago,
> 
> What was the error that made you make the following change, and on what database?
> 
> Before your change, the code used to generate
> 
> SELECT ... ORDER BY UNION SELECT ... ORDER BY
> 
> and after your change generates
> 
> (SELECT ... ORDER BY) UNION (SELECT ... ORDER BY)
> 
> ORDER BY inside a subquery is illegal per the SQL standard (and as it happens makes MongoDB's parser barf), so I wonder if that was the real problem you were facing. I am fixing it to generate
> 
>  (SELECT ...) UNION (SELECT ...) ORDER BY
> 
> and, since simpler is better, I wonder if I could go one step further and generate
> 
>  SELECT ... UNION SELECT ... ORDER BY
> 
> To help me decide, it would help to know why you added the parentheses in the first place.
> 
> Julian
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian



More information about the Mondrian mailing list