Re: How to add function schema in search_path in option definitio

From: Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to add function schema in search_path in option definitio
Date: 2023-07-09 20:47:51
Message-ID: CAJMpnG67ZYKk47C75umomp2=A4rW9z33KyA15goZ7QYL=n=DXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Adrian and Peter,
yes the set parameter in function definition is also my preferred choice,
but....

I need to add the schema to path, not to substitute the path, this is my
problem

Il giorno dom 9 lug 2023 alle ore 13:02 Peter J. Holzer <hjp-pgsql(at)hjp(dot)at>
ha scritto:

> On 2023-07-08 19:00:02 +0200, Lorusso Domenico wrote:
> > I've created a schema to handle some specific features.
> > In the schema there are a couple of tables used by many functions (more
> than
> > 20).
> > In other words, I've created a schema as a package (as suggested in many
> > points).
>
> So this is one specific schema with a specific name and you don't need
> this to work in any schema the function happens to be created in?
>
> Then I think setting the search path as part of the function definition
> (as already hinted at by Adrian) may be the easiest solution:
>
> create function my_schema.foo (...)
> returns ...
> set search_path to my_schema, public
> as $$
> ...
> $$;
>
> You could also do something like:
>
> set search_path to my_schema, public;
> create function foo (...)
> returns ...
> set search_path from current
> as $$
> ...
> $$;
>
> hp
>
> --
> _ | Peter J. Holzer | Story must make more sense than reality.
> |_|_) | |
> | | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
> __/ | http://www.hjp.at/ | challenge!"
>

--
Domenico L.

per stupire mezz'ora basta un libro di storia,
io cercai di imparare la Treccani a memoria... [F.d.A.]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-07-09 21:21:22 Re: How to add function schema in search_path in option definitio
Previous Message Zheng Li 2023-07-09 19:22:05 Re: Support logical replication of DDLs