Re: PL/pgSQL PERFORM with CTE - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: PL/pgSQL PERFORM with CTE
Date
Msg-id 688514C3-CC7C-4575-B112-AC120336B567@justatheory.com
Whole thread Raw
In response to Re: PL/pgSQL PERFORM with CTE  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: PL/pgSQL PERFORM with CTE  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: PL/pgSQL PERFORM with CTE  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Hi Pavel,

On Aug 20, 2013, at 2:11 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:

>>     david=# DO $$
>>     david$# BEGIN
>>     david$#     WITH now AS (SELECT now())
>>     david$#     PERFORM * from now;
>>     david$# END;
>>     david$# $$;
>>     ERROR:  syntax error at or near "PERFORM"
>>     LINE 4:     PERFORM * from now;
>>                 ^
>> Parser bug in PL/pgSQL, perhaps?
>
> no
>
> you cannot use a PL/pgSQL statement inside SQL statement.

Well, there ought to be *some* way to tell PL/pgSQL to discard the result. Right now I am adding a variable to select
intobut never otherwise use. Inelegant, IMHO. Perhaps I’m missing some other way to do it? 

If so, it would help if the hint suggesting the use of PERFORM pointed to such alternatives.

Best,

David




pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: PL/pgSQL PERFORM with CTE
Next
From: Pavel Stehule
Date:
Subject: Re: PL/pgSQL PERFORM with CTE