Re: Can't use WITH in a PERFORM query in PL/pgSQL?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: depstein(at)alliedtesting(dot)com, pgsql-bugs(at)postgresql(dot)org, pgagarinov(at)alliedtesting(dot)com, vshahov(at)alliedtesting(dot)com
Subject: Re: Can't use WITH in a PERFORM query in PL/pgSQL?
Date: 2011-03-24 15:54:27
Message-ID: AANLkTi=9G5Uoc1gG0poqE-pZbBMr+1JBbuHNPp+rq0b3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Mar 24, 2011 at 10:36 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2011-03-24 18:08:28 Re: Service Wont Start
Previous Message Nathan M. Davalos 2011-03-24 15:48:49 Re: BUG #5944: COPY FROM doesn't work with international characters