Re: Can't use WITH in a PERFORM query in PL/pgSQL? - Mailing list pgsql-bugs

From Merlin Moncure
Subject Re: Can't use WITH in a PERFORM query in PL/pgSQL?
Date
Msg-id AANLkTi=9G5Uoc1gG0poqE-pZbBMr+1JBbuHNPp+rq0b3@mail.gmail.com
Whole thread Raw
In response to Re: Can't use WITH in a PERFORM query in PL/pgSQL?  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-bugs
On Thu, Mar 24, 2011 at 10:36 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Hello
>
> why you can do it?
>
> please, try to RETURN QUERY ...
>
> Regards
>
> Pavel Stehule
>
>
>>
>> $$begin
>>
>> perform(
>>
>> with A as (select generate_series(1,3) as foo)
>>
>> select foo from A
>>
>> );
>>
>> end$$;

This is 'DO' statement.  Also I think this is legitimate bug:

you can do perform func(foo_id) from something;

but not

with something as (something)
perform func(foo_id) from something;

this might do as workaround:
do
$$begin
perform(
with A as (select 1 as foo)
select array(select foo from A)
);
end$$;

merlin

pgsql-bugs by date:

Previous
From: "Nathan M. Davalos"
Date:
Subject: Re: BUG #5944: COPY FROM doesn't work with international characters
Next
From: Heikki Linnakangas
Date:
Subject: Re: Service Wont Start