Re: Submitting a query inside the backend

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Submitting a query inside the backend
Дата
Msg-id 20100105140301.GB3660@alvh.no-ip.org
обсуждение исходный текст
Ответ на Submitting a query inside the backend  (Robert Wittauer <robert.wittauer@googlemail.com>)
Список pgsql-hackers
Robert Wittauer wrote:
> As part of a research project I would like to change the source code of
> Postgres. There, I want to do the following: I want to stop the optimizer at
> some place, issue a query from the optimizer and use the result of the query
> to continue the optimization process.
> 
> Is there a good and clean way how I could do this? I want to submit another
> query inside the existing connection and optimizer code.  Is there some
> function I could use? I don’t want to do a hardcoded scan of a table, I want
> to build a query string and use the parser, analyzer, optimizer, and
> executer to submit the query.

Not necessarily a good idea, but you can use the SPI family of functions
to run queries from inside the backend.  Not sure how well it will work
from the optimizer (consider infinite recursion)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: [PATCH] Windows x64 [repost]
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: libpq naming on Win64