Re: 9.5 Create Function Set From Current taken at creation time?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: 9.5 Create Function Set From Current taken at creation time?
Дата
Msg-id CAKFQuwbtGWGPO4EhNwwtOQBAiw3raQzVKqF83=siOq3iev5tUA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 9.5 Create Function Set From Current taken at creation time?  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: 9.5 Create Function Set From Current taken at creation time?
Список pgsql-bugs
On Tue, Aug 9, 2016 at 9:10 AM, Peter Eisentraut <
peter.eisentraut@2ndquadrant.com> wrote:

> On 8/8/16 5:46 PM, David G. Johnston wrote:
> > """
> > The SET clause causes the specified configuration parameter to be set t=
o
> > the specified value when the function is entered, and then restored to
> > its prior value when the function exits. SET FROM CURRENT saves the
> > session's current value of the parameter as the value to be applied whe=
n
> > the function is entered.
> > """
> >
> > https://www.postgresql.org/docs/current/static/sql-createfunction.html
> >
> > I expect the attached script to output "NOTICE: SP : thirdschema",
> > instead it outputs "NOTICE: SP: otherschema"
>
> I think the piece you are missing is that it saves the setting when the
> function is created, not when it is run.
>

With hindsight =E2=80=8BI understand this perfectly (and I swear I've broug=
ht this
up before and subsequently forgot)...

=E2=80=8BCan we change the second sentence in the above quote to something =
like:=E2=80=8B

=E2=80=8BSET FROM CURRENT is a convenience expression to capture the result=
 of
current_setting('setting name') at the time of the function's creation. [if
more than just convenience an example of when this is useful would be nice]=
.
=E2=80=8B
The fact that there is no way obtain the useful "restored to its prior
value" behavior without specifying an explicit value is a short-coming, not
a bug.  That said, changing search_paths in a function is likely asking for
trouble anyway so the lack probably isn't something worth fixing.

=E2=80=8BDavid J.=E2=80=8B


=E2=80=8B

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: 9.5 Create Function Set From Current taken at creation time?
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: BUG #14228: replication slot catalog_xmin not cleared on slot reuse