Re: PL/pgSQL PERFORM with CTE

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL PERFORM with CTE
Date: 2013-08-20 12:11:52
Message-ID: CAFj8pRAoTGZYWtvidW+G8b0Aq2WG9A4e1iphDHwacUnB=9hhoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

2013/8/20 David E. Wheeler <david(at)justatheory(dot)com>

> Hackers,
>
> This seems reasonable:
>
> david=# DO $$
> david$# BEGIN
> david$# WITH now AS (SELECT now())
> david$# SELECT * from now;
> david$# END;
> david$# $$;
> ERROR: query has no destination for result data
> HINT: If you want to discard the results of a SELECT, use PERFORM
> instead.
> CONTEXT: PL/pgSQL function inline_code_block line 3 at SQL statement
>
> This not so much:
>
> 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.

Regards

Pavel

>
> Best,
>
> David
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2013-08-20 12:15:55 Re: PL/pgSQL PERFORM with CTE
Previous Message David E. Wheeler 2013-08-20 12:04:08 PL/pgSQL PERFORM with CTE