[HACKERS] Combine non-recursive and recursive CTEs?

2012-06-16 Thread Magnus Hagander
I'm not sure if this is something I don't know how to do, or if it's something we simply can't do, or if it's something we could do but the syntax can't handle :-) Basically, I'd like to combine a recursive and a non-recursive CTE in the same query. If I do it non-recursive, I can do something

Re: [HACKERS] Combine non-recursive and recursive CTEs?

2012-06-16 Thread PostgreSQL - Hans-Jürgen Schönig
On Jun 16, 2012, at 8:27 AM, Magnus Hagander wrote: I'm not sure if this is something I don't know how to do, or if it's something we simply can't do, or if it's something we could do but the syntax can't handle :-) Basically, I'd like to combine a recursive and a non-recursive CTE in the

Re: [HACKERS] Combine non-recursive and recursive CTEs?

2012-06-16 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes: Basically, I'd like to combine a recursive and a non-recursive CTE in the same query. Just mark them all as recursive. There's no harm in marking a CTE as recursive when it isn't really. Trying something like: WITH t1 (z,b) AS ( SELECT a,b

Re: [HACKERS] Combine non-recursive and recursive CTEs?

2012-06-16 Thread Magnus Hagander
On Sat, Jun 16, 2012 at 2:52 PM, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net writes: Basically, I'd like to combine a recursive and a non-recursive CTE in the same query. Just mark them all as recursive.  There's no harm in marking a CTE as recursive when it isn't