Re: [GENERAL] WITH and WITH RECURSIVE in single query

2011-12-04 Thread Maxim Boguk
On Mon, Dec 5, 2011 at 3:15 PM, David Johnston wrote: > On Dec 4, 2011, at 22:58, Maxim Boguk wrote: > > > > On Mon, Dec 5, 2011 at 2:45 PM, David Johnston < > pol...@yahoo.com> wrote: > >> On Dec 4, 2011, at 22:28, Maxim Boguk < >> maxim.bo...@gmail.com> wrote: >> >> > Hi. >> > >> > Is here a

Re: [GENERAL] WITH and WITH RECURSIVE in single query

2011-12-04 Thread David Johnston
On Dec 4, 2011, at 22:58, Maxim Boguk wrote: > > > On Mon, Dec 5, 2011 at 2:45 PM, David Johnston wrote: > On Dec 4, 2011, at 22:28, Maxim Boguk wrote: > > > Hi. > > > > Is here any way to combine WITH and WITH RECURSIVE into single query? > > > > Something like: > > > > WITH t AS (some comp

Re: [GENERAL] WITH and WITH RECURSIVE in single query

2011-12-04 Thread Maxim Boguk
On Mon, Dec 5, 2011 at 2:45 PM, David Johnston wrote: > On Dec 4, 2011, at 22:28, Maxim Boguk wrote: > > > Hi. > > > > Is here any way to combine WITH and WITH RECURSIVE into single query? > > > > Something like: > > > > WITH t AS (some complicated select to speed up recursive part), > > RECURSI

Re: [GENERAL] WITH and WITH RECURSIVE in single query

2011-12-04 Thread David Johnston
On Dec 4, 2011, at 22:28, Maxim Boguk wrote: > Hi. > > Is here any way to combine WITH and WITH RECURSIVE into single query? > > Something like: > > WITH t AS (some complicated select to speed up recursive part), > RECURSIVE r AS > ( > ... > UNION ALL > ... > ) > > ? > > -- > Maxim Boguk >

Re: [GENERAL] WITH and WITH RECURSIVE in single query

2011-12-04 Thread Tom Lane
Maxim Boguk writes: > Is here any way to combine WITH and WITH RECURSIVE into single query? You have to put RECURSIVE immediately after WITH, but that doesn't force you to actually make any particular query in the WITH-list recursive. It just makes it possible for a query to be self-referential,