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

From Vik Reykja
Subject Re: Can't use WITH in a PERFORM query in PL/pgSQL?
Date
Msg-id AANLkTikjz_sCg_KjTLyyjFcMEy2D=t=bG0Ju98Jsu_-E@mail.gmail.com
Whole thread Raw
In response to Can't use WITH in a PERFORM query in PL/pgSQL?  (<depstein@alliedtesting.com>)
List pgsql-bugs
On Sun, Mar 6, 2011 at 14:29, <depstein@alliedtesting.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=
=E2=80=99t
> 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';

pgsql-bugs by date:

Previous
From:
Date:
Subject: Can't use WITH in a PERFORM query in PL/pgSQL?
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5915: OldSerXidAdd inflates pg_serial too much