Re: Remove restrictions in recursive query - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Remove restrictions in recursive query
Date
Msg-id CAKFQuwauVQE=x5aGnh=Jv1d_smteHDGv4NVwzmy8+wVRJBT-UA@mail.gmail.com
Whole thread Raw
In response to Remove restrictions in recursive query  (Renan Alves Fonseca <renanfonseca@gmail.com>)
List pgsql-hackers
On Thu, Mar 27, 2025 at 9:02 AM Renan Alves Fonseca <renanfonseca@gmail.com> wrote:
So, do we support the ORDER BY in a recursive query or not?

Apparently we do.  The "in" recurses.

If the answer is yes, I suggest one of the following modifications: 
1. Change the error message to something like "ORDER BY at the top level of a recursive query is not implemented. HINT: wrap the respective statement around ()"

The error message is now correct but I'd lose the hint.  It assumes a typo and that the query author meant to sort each iteration of the recursive term; when maybe they did wish for the final result of the completed recursive query to then be fed into a sort node and ordered, in which case the parentheses wouldn't help.

David J.

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Remove restrictions in recursive query
Next
From: Alvaro Herrera
Date:
Subject: Re: Test to dump and restore objects left behind by regression