On Tue, Sep 19, 2023 at 5:56 PM Jeff Davis <pgsql@j-davis.com> wrote: >... > On Tue, 2023-09-19 at 11:41 -0400, Robert Haas wrote: > > That leads to a second idea, which is having it continue > > to be a GUC but only affect directly-entered SQL, with all > > indirectly-entered SQL either being stored as a node tree or having a > > search_path property attached somewhere. > > That's not too far from the proposed patch and I'd certainly be > interested to hear more and/or adapt my patch towards this idea.
As an interested bystander, that's the same thing I was thinking when reading this. I reread your original e-mail, Jeff, and I still think that.
I wonder if something like CURRENT (i.e., the search path at function creation time) might be a useful keyword addition. I can see some uses (more forgiving than SYSTEM but not as loose as SESSION), but I don't know if it would justify its presence.
Personally, I dislike this - because the value of the search path is hidden in this case.
I agree so it can be comfortable, but it can be confusing for review, migration, ...