Re: Remove restrictions in recursive query

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Renan Alves Fonseca <renanfonseca(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Remove restrictions in recursive query
Date: 2025-03-27 17:00:11
Message-ID: CAKFQuwauVQE=x5aGnh=Jv1d_smteHDGv4NVwzmy8+wVRJBT-UA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 27, 2025 at 9:02 AM Renan Alves Fonseca <renanfonseca(at)gmail(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2025-03-27 17:15:06 Re: Test to dump and restore objects left behind by regression
Previous Message Robert Haas 2025-03-27 16:39:55 Re: Remove restrictions in recursive query