Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Isaac Morland
On Fri, 3 Jan 2025 at 18:22, Jan Behrens wrote: > Instead, I plan to expect the function to receive a query string that > will get the data that is being processed by the function. > > That query string should be allowed to refer to tables in the > search_path at the caller's side. > > Therefore

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Jan Behrens
On Sat, 4 Jan 2025 00:22:03 +0100 Jan Behrens wrote: > > -- Do I have to fully qualify types and operators from > -- "myschema" here? Or is it safe to not fully qualify them? > ---

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Jan Behrens
On Fri, 3 Jan 2025 13:56:02 -0800 Adrian Klaver wrote: > At this point I am lost as to what the overall goal of this is. > > Can you provide a 1 ft view if what it is you are trying to achieve? Sure! I would like to create a component (e.g. a PostgreSQL extension) that provides a function w

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread David G. Johnston
On Fri, Jan 3, 2025 at 2:33 PM Jan Behrens wrote: > I would prefer my current solution, but I would like to be sure that my > example (the one in my e-mail dated Fri, 3 Jan 2025 13:53:32 +0100) is > correct. I still am not sure about that. > > If it does what you want and it is only ever executed

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Adrian Klaver
On 1/3/25 13:33, Jan Behrens wrote: On Fri, 3 Jan 2025 10:16:15 -0700 "David G. Johnston" wrote: But if I use "SET search_path FROM CURRENT", then the called function won't know the search_path that is set at the caller's side (which is what I need to make my interface nice to use). At th

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Jan Behrens
On Fri, 3 Jan 2025 10:16:15 -0700 "David G. Johnston" wrote: > It is at risk because it depends on the session search_path. That is all. > Whether that risk turns into a failure to execute depends on how/when it is > executed. I'm not that comfortable talking about security risks in this > cont

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread David G. Johnston
On Fri, Jan 3, 2025 at 9:48 AM Jan Behrens wrote: > On Fri, 3 Jan 2025 08:34:57 -0700 > "David G. Johnston" wrote: > > > On Friday, January 3, 2025, Jan Behrens wrote: > > > > > > I would like to know if the above example is correct. It seems overall > > > bulky, but I haven't found a better wa

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Jan Behrens
On Fri, 3 Jan 2025 08:34:57 -0700 "David G. Johnston" wrote: > On Friday, January 3, 2025, Jan Behrens wrote: > > > > I would like to know if the above example is correct. It seems overall > > bulky, but I haven't found a better way, assuming that it can be > > unknown where a particular extensi

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread David G. Johnston
On Friday, January 3, 2025, Jan Behrens wrote: > > I would like to know if the above example is correct. It seems overall > bulky, but I haven't found a better way, assuming that it can be > unknown where a particular extension has been installed to. In > particular I feel a bit insecure about whe

Re: search_path for PL/pgSQL functions partially cached?

2025-01-03 Thread Jan Behrens
On Sat, 28 Dec 2024 00:40:09 +0100 Jan Behrens wrote: > > Add qualification or attach a “set search_path” clause to “create > > function”. Code stored in the server should not rely on the session > > search_path. > > > > David J. I have been trying to adjust some of my code, and I still have c