Re: PL/pgSQL PERFORM with CTE
| От | Pavel Stehule |
|---|---|
| Тема | Re: PL/pgSQL PERFORM with CTE |
| Дата | |
| Msg-id | CAFj8pRDmd3JDdJ8MtL_E7JbBnFn8KYA=Ykee9JJoEhoN932JEw@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: PL/pgSQL PERFORM with CTE ("David E. Wheeler" <david@justatheory.com>) |
| Ответы |
Re: PL/pgSQL PERFORM with CTE
|
| Список | pgsql-hackers |
2013/8/20 David E. Wheeler <david@justatheory.com>
postgres=# DO $$
BEGIN
PERFORM * FROM (WITH now AS (SELECT now())
SELECT * from now) x;
END;
$$;
DO
postgres=#
Hi Pavel,Well, there ought to be *some* way to tell PL/pgSQL to discard the result. Right now I am adding a variable to select into but never otherwise use. Inelegant, IMHO. Perhaps I’m missing some other way to do it?
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.
If so, it would help if the hint suggesting the use of PERFORM pointed to such alternatives.
postgres=# DO $$
BEGIN
PERFORM * FROM (WITH now AS (SELECT now())
SELECT * from now) x;
END;
$$;
DO
postgres=#
Regards
Pavel
Best,
David
В списке pgsql-hackers по дате отправления: