Per-function GUC settings: trickier than it looked

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Per-function GUC settings: trickier than it looked
Дата
Msg-id 23461.1188699724@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: Per-function GUC settings: trickier than it looked
Список pgsql-hackers
So I coded up a patch for this, based on the idea of creating a
quasi-subtransaction that affects only GUC while entering/exiting a
function that has GUC settings attached.  The specified settings are
applied as if by SET LOCAL before starting function execution, and then
they drop out during "subtransaction" exit.  (I'll post the code to
pgsql-patches in a moment.)

But on reflection I realize that there are some interesting properties
to this approach:

* if you do "SET LOCAL foo" when you are in a function that has a "SET foo" property, the setting disappears at
functionexit.  But if you do "SET foo" it persists.  This might be OK, but it seems a bit odd.
 

* in fact, if you do "SET LOCAL foo" when you are in a function that has any "SET" property at all, the setting
disappearsat function exit, whether foo was one of the variables SET by the function definition or not.
 

We could perhaps get away with defining that as being the behavior,
but it doubtless will surprise someone sometime.  What *should* these
interactions be like, and has anyone got an idea how to implement their
suggestion?
        regards, tom lane


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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: synchronous_commit: Developer's View
Следующее
От: Tom Lane
Дата:
Сообщение: Re: synchronous_commit: Developer's View