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

From: Vik Reykja <vikreykja(at)gmail(dot)com>
To: depstein(at)alliedtesting(dot)com
Cc: 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-06 14:57:53
Message-ID: AANLkTikjz_sCg_KjTLyyjFcMEy2D=t=bG0Ju98Jsu_-E@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Mar 6, 2011 at 14:29, <depstein(at)alliedtesting(dot)com> wrote:

> The only workaround that I can think of is to use a dummy variable to
> capture the query result. This has to be done even when the query doesn’t
> have a result (as when calling a function returning void).
>
>
>
> do
>
> $$declare
>
> dummy record;
>
> begin
>
> with A as (select 1 as foo)
>
> select foo into dummy from A;
>
> end$$;
>
>
Or use parentheses:

do $$
begin
perform (with A as (select 1 as foo)
select foo from A);
end;
$$ language 'plpgsql';

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2011-03-06 18:32:27 Re: BUG #5915: OldSerXidAdd inflates pg_serial too much
Previous Message depstein 2011-03-06 13:29:28 Can't use WITH in a PERFORM query in PL/pgSQL?