Re: Remove restrictions in recursive query

2025-03-27 Thread Renan Alves Fonseca
On Thu, Mar 27, 2025 at 10:50 PM Tom Lane wrote: > > Renan Alves Fonseca writes: > > The solution using GROUP BY in the recursive query is the following: > > > with recursive t1(node,nb_path) as > > (select 1,1::numeric > >union all > >

Re: Remove restrictions in recursive query

2025-03-27 Thread Renan Alves Fonseca
On Thu, Mar 27, 2025 at 7:32 PM Robert Haas wrote: > > > I'll assume that the silence about allowing GROUP BY means it is not a > > great idea... > > I don't think there's really anything to keep you from doing this -- > just put the grouping operation where you refer to the recursive CTE, > inste

Remove restrictions in recursive query

2025-03-27 Thread Renan Alves Fonseca
Hi, I'm confused about what we should allow in a recursive query. For example, in the following query: WITH RECURSIVE t1 AS ( SELECT 1 UNION SELECT generate_series(2,3) FROM t1 ORDER BY 1 DESC) SELECT * FROM t1 ; The parser attaches the "order by" clause to the "union" operator, and then we er

Re: Remove restrictions in recursive query

2025-03-27 Thread Renan Alves Fonseca
On Thu, Mar 27, 2025 at 7:10 PM David G. Johnston 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 F

Re: Remove restrictions in recursive query

2025-03-27 Thread Renan Alves Fonseca
On Thu, Mar 27, 2025 at 5:38 PM Robert Haas wrote: > It's not a problem if UNION ALL is used within the initial_query and > it's not a problem if UNION ALL is used within the iterated_query. But > you can't apply ORDER BY to the result of the UNION, because the UNION > is kind of fake -- we're not

Re: Remove restrictions in recursive query

2025-03-28 Thread Renan Alves Fonseca
On Fri, Mar 28, 2025 at 1:14 AM Tom Lane wrote: > > Well, we extend the spec in lots of places. I'd be okay with removing > this restriction if I were sure there were no bad consequences, but > it seems likely that there are some. College math was way too long > ago for me to be sure about the "

Document SQL functions behavior regarding custom/generic plan

2025-04-01 Thread Renan Alves Fonseca
Hi, In [1], we discussed adding some lines regarding the fact that SQL functions always use generic plan. Here is the suggested patch. I've tested on V17 and V12. It does not concern V18. Regards, Renan [1] https://www.postgresql.org/message-id/CAApHDvp3EDrVhGjmb21bceJ5-Y7iXKOn2UGG3-ngp_9ob_mpL

Re: [PATCH] Support older Pythons in oauth_server.py

2025-04-22 Thread Renan Alves Fonseca
Jacob Champion writes: > > This is tested against Python 3.6.15 (3.6 went EOL at the end of > 2021). I'm working on getting Rocky 8 installed locally to test > against. If it's decided we want to support downwards to 3.5, I will > test there too (but I hope we don't; see parent thread). > I did

Re: What's our minimum supported Python version?

2025-04-22 Thread Renan Alves Fonseca
Tom Lane writes: > Florents Tselai writes: >> On 19 Apr 2025, at 7:17 PM, Tom Lane wrote: >>> I think we need to do some combination of moving our >>> minimum-supported-version goalposts forward, making sure that >>> whatever we claim is the minimum Python version is actually >>> being tested i

Prototype: Implement dead tuples xid histograms

2025-04-16 Thread Renan Alves Fonseca
Hi hackers, in a recent hacking workshop organized by Robert Haas, we discussed [1]. Among the autovacuum issues exposed, the useless vacuum case caught my attention. I've started to study the respective code and I came up with a prototype to improve the statistics system regarding dead tuples. T