On Thu, Mar 27, 2025 at 7:10 PM David G. Johnston
<david.g.johns...@gmail.com> wrote:
>
> There is distinct behavior between group by and order by here.  You seem to 
> be mixing them up.
>
> From Select:
>
> select_statement is any SELECT statement without an ORDER BY, LIMIT, FOR NO 
> KEY UPDATE, FOR UPDATE, FOR SHARE, or FOR KEY SHARE clause. (ORDER BY and 
> LIMIT can be attached to a subexpression if it is enclosed in parentheses. 
> Without parentheses, these clauses will be taken to apply to the result of 
> the UNION, not to its right-hand input expression.)
>
> This is the exact same parsing precedence order by is being given in the 
> recursive CTE query situation presented earlier.
>
> David J.
>

You're right. I'm really mixing these 2 here. Thanks for the clarification.

I'll assume that the silence about allowing GROUP BY means it is not a
great idea...


Reply via email to