Re: Tuning queries inside a function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Tuning queries inside a function
Дата
Msg-id 1025.1115060708@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Tuning queries inside a function  ("Joshua D. Drake" <jd@commandprompt.com>)
Список pgsql-general
"Joshua D. Drake" <jd@commandprompt.com> writes:
> Mike Nolan wrote:
>> That part I get, but I cannot seem to get an 'explain select....' to return
>> the explain output inside a function.

> Oh interesting. Hmmm. Alvaro can you think of a way to execute the
> result into a variable and return it as a notice?

I think it's done already, at least if you are using a recent release.
I note the following relevant items in the CVS log:

2005-04-05 14:05  tgl

    * doc/src/sgml/plpgsql.sgml, src/pl/plpgsql/src/gram.y: Adjust
    grammar for plpgsql's OPEN command so that a cursor can be OPENed
    on non-SELECT commands such as EXPLAIN or SHOW (anything that
    returns tuples is allowed).  This flexibility already existed for
    bound cursors, but OPEN was artificially restricting what it would
    take.  Per a gripe some months back.

2005-02-10 15:36  tgl

    * src/backend/: executor/spi.c, tcop/pquery.c (REL8_0_STABLE),
    executor/spi.c, tcop/pquery.c: Fix SPI cursor support to allow
    scanning the results of utility commands that return tuples (such
    as EXPLAIN).  Per gripe from Michael Fuhr.  Side effect: fix an old
    bug that unintentionally disabled backward scans for all
    SPI-created cursors.

(The latter is in 8.0.2 and up, the former only in CVS tip.)

This is relevant to plpgsql because both "FOR ... IN query" and plpgsql
cursors depend on SPI cursors.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Vlad
Дата:
Сообщение: Re: [Dbdpg-general] Re: 'prepare' is not quite schema-safe
Следующее
От: Jonel Rienton
Дата:
Сообщение: PostgreSQL 8.0.2 and Tiger