Re: wrong search_path being used

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: wrong search_path being used
Дата
Msg-id 20130112185917.255770@gmx.com
обсуждение исходный текст
Ответ на wrong search_path being used  (Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>)
Ответы Re: wrong search_path being used  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Rodrigo Rosenfeld Rosas wrote:

> I'm curious though. Why wouldn't this behavior be considered a
> bug? Is there any link to previous discussions about this subject
> that I could read?

A plpgsql function generates a plan on initial execution which
chooses which particular tables are used. On subsequent executions
that saves the overhead of parsing out the statement and looking up
the table and its details, which can help performance quite a bit.
If you want to have source code evaluated each time the function is
called, you should use the EXECUTE statement within your function
body, which will force parsing and path resolution of the statement
for each execution. That should give you the behavior you want,
with some cost in performance.

To try to get your function code to work as you expect, the
language would essentially need to identify which statements could
be pre-planned, and which would needed to be treated as raw source
on each execution. That would be tricky to implement, and would
itself have some run-time cost. At this point we've put the burden
on the programmer to identify this at the time the code is written,
rather than adding run-time expense.

-Kevin

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

Предыдущее
От: Vitalii Tymchyshyn
Дата:
Сообщение: Re: [JDBC] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception
Следующее
От: Tom Lane
Дата:
Сообщение: Re: wrong search_path being used