Re: PL/pgSQL PERFORM with CTE
От | Andres Freund |
---|---|
Тема | Re: PL/pgSQL PERFORM with CTE |
Дата | |
Msg-id | 20130820122539.GA21096@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: PL/pgSQL PERFORM with CTE ("David E. Wheeler" <david@justatheory.com>) |
Ответы |
Re: PL/pgSQL PERFORM with CTE
Re: PL/pgSQL PERFORM with CTE |
Список | pgsql-hackers |
On 2013-08-20 14:15:55 +0200, David E. Wheeler wrote: > 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. Not that that's elegant but IIRC PERFORM (WITH ...) ought to work. I don't think the intermingled plpgsql/sql grammars allow a nice way right now. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-hackers по дате отправления: