Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group