9.5 Create Function Set From Current taken at creation time?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: 9.5 Create Function Set From Current taken at creation time?
Date: 2016-08-08 21:46:33
Message-ID: CAKFQuwa=PBrKeXKv1kukEY81J6LkVHo7yRE6yM+FO6Dv+4stcQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Reading this:

"""
The SET clause causes the specified configuration parameter to be set to
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 when 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"

Either the wording in the docs is poor or this is broken. If the former it
would help to provide an example in said docs as to when one would wish to
use "FROM CURRENT" to clarify its intended use.

As I presently read it I get to SET LOCAL search_path within my function
without any concern about affecting the caller's execution environment.
Simply inheriting the caller's search_path and then making changes
in-function will result in those changes remaining.

Thanks!

David J.

P.S. I have the EXECUTE in their since that was original need and thought
maybe it was a contributing factor...

Attachment Content-Type Size
output.txt text/plain 1.1 KB
example.psql application/octet-stream 763 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2016-08-09 13:10:04 Re: 9.5 Create Function Set From Current taken at creation time?
Previous Message Gerardo Herzig 2016-08-08 11:21:00 Re: [PERFORM] Create language plperlu Error