Re: PL/pgSQL PERFORM with CTE - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: PL/pgSQL PERFORM with CTE
Date
Msg-id CAFj8pRAqpz=HeZMF-DPBRru23Hxu+zZqVgU+wh-jypCFwuEDQA@mail.gmail.com
Whole thread Raw
In response to Re: PL/pgSQL PERFORM with CTE  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: PL/pgSQL PERFORM with CTE  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-hackers



2013/8/20 David E. Wheeler <david@justatheory.com>
On Aug 20, 2013, at 2:24 PM, Marko Tiikkaja <marko@joh.to> wrote:

>> postgres=# DO $$
>>  BEGIN
>>    PERFORM * FROM (WITH now AS (SELECT now())
>>   SELECT * from now) x;
>>  END;
>> $$;
>> DO
>
> .. which doesn't work if you want to use table-modifying CTEs.

Which, in fact, is exactly my use case (though not what I posted upthread).

but it works

postgres=# do $$begin with x as (select 10) insert into omega select * from x; end;$$;
DO

Regards

Pavel

 

Best,

David


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: PL/pgSQL PERFORM with CTE
Next
From: "David E. Wheeler"
Date:
Subject: Re: PL/pgSQL PERFORM with CTE