Re: initialize and use variable in query

2020-02-05 Thread Олег Самойлов
Just refactor DO block to function that returns row set and put SELECT inside. > 29 дек. 2018 г., в 18:40, Glenn Schultz написал(а): > > All, > > I need to initialize a variable and then use it in query. Ultimately this > will part of a recursive CTE but for now I just need to work this out.

Re: initialize and use variable in query

2018-12-29 Thread Glenn Schultz
Thanks! On Sat, Dec 29, 2018 at 10:06 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Saturday, December 29, 2018, Ray O'Donnell wrote: >> >> A couple of things off the top of my head: > > > Sorry but, no. > >> >> (i) I think you need "language plpgsql" (or whatever) after the DO

initialize and use variable in query

2018-12-29 Thread David G. Johnston
On Saturday, December 29, 2018, Ray O'Donnell wrote: > > A couple of things off the top of my head: Sorry but, no. > > (i) I think you need "language plpgsql" (or whatever) after the DO block. As the docs state plpgsql is the default for a DO block lacking a language specifier. > (ii) That

Re: initialize and use variable in query

2018-12-29 Thread David G. Johnston
On Saturday, December 29, 2018, Glenn Schultz wrote: > All, > > I need to initialize a variable and then use it in query. Ultimately this > will part of a recursive CTE but for now I just need to work this out. I > followed the docs and thought I needed something like this. But does not > work

Re: initialize and use variable in query

2018-12-29 Thread Ray O'Donnell
On 29/12/2018 15:40, Glenn Schultz wrote: All, I need to initialize a variable and then use it in query. Ultimately this will part of a recursive CTE but for now I just need to work this out.  I followed the docs and thought I needed something like this.  But does not work-maybe I have misun

initialize and use variable in query

2018-12-29 Thread Glenn Schultz
All, I need to initialize a variable and then use it in query. Ultimately this will part of a recursive CTE but for now I just need to work this out. I followed the docs and thought I needed something like this. But does not work-maybe I have misunderstood. Is this possible? SET max_parallel_