public inbox for [email protected]help / color / mirror / Atom feed
How to use one function which can be accessed for all schemas 5+ messages / 5 participants [nested] [flat]
* How to use one function which can be accessed for all schemas @ 2024-01-09 08:15 intmail01 <[email protected]> 0 siblings, 2 replies; 5+ messages in thread From: intmail01 @ 2024-01-09 08:15 UTC (permalink / raw) To: [email protected] Hi, I have several schemas in my database, I want to create just one function to use with all these schema. I create the function in a main schema then the trigger call the function and error occurs : "No function matches the given name and argument types. You might need to add explicit type casts." How to use just one function which can be work amongst all shemas in the db ? My objective is to reduce update of functions code just once not for many schemas. I dont want to duplicate my functions for each schema. Thanks ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to use one function which can be accessed for all schemas @ 2024-01-09 15:29 Tom Lane <[email protected]> parent: intmail01 <[email protected]> 1 sibling, 0 replies; 5+ messages in thread From: Tom Lane @ 2024-01-09 15:29 UTC (permalink / raw) To: intmail01 <[email protected]>; +Cc: [email protected] intmail01 <[email protected]> writes: > I have several schemas in my database, I want to create just one function > to use with all these schema. > I create the function in a main schema then the trigger call the function > and error occurs : "No function matches the given name and argument types. > You might need to add explicit type casts." You can either explicitly schema-qualify the function call, or make sure that that main schema is always present in your search_path. regards, tom lane ^ permalink raw reply [nested|flat] 5+ messages in thread
* How to use one function which can be accessed for all schemas @ 2024-01-09 16:39 Wetmore, Matthew (CTR) <[email protected]> parent: intmail01 <[email protected]> 1 sibling, 1 reply; 5+ messages in thread From: Wetmore, Matthew (CTR) @ 2024-01-09 16:39 UTC (permalink / raw) To: intmail01 <[email protected]>; [email protected] <[email protected]> Schema qualify your function and trigger names. Schema qualify everything, it’s good practice and doesn’t need to rely on search_path. This error say exactly that. CREATE FUNCTION test(… CREATE FUNCTION myschema.test( From: intmail01 <[email protected]> Sent: Tuesday, January 9, 2024 12:15 AM To: [email protected] Subject: [EXTERNAL] How to use one function which can be accessed for all schemas Hi, I have several schemas in my database, I want to create just one function to use with all these schema. I create the function in a main schema then the trigger call the function and error occurs : "No function matches the given name and argument types. You might need to add explicit type casts." How to use just one function which can be work amongst all shemas in the db ? My objective is to reduce update of functions code just once not for many schemas. I dont want to duplicate my functions for each schema. Thanks ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to use one function which can be accessed for all schemas @ 2024-01-09 18:09 Bindra Bambharoliya <[email protected]> parent: Wetmore, Matthew (CTR) <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Bindra Bambharoliya @ 2024-01-09 18:09 UTC (permalink / raw) To: Wetmore, Matthew (CTR) <[email protected]>; +Cc: intmail01 <[email protected]>; [email protected] Create function in public or catalog schema. This function will be visible to each schema and user On Tue, 9 Jan 2024, 22:10 Wetmore, Matthew (CTR), < [email protected]> wrote: > Schema qualify your function and trigger names. Schema qualify > everything, it’s good practice and doesn’t need to rely on search_path. > > This error say exactly that. > > > > CREATE FUNCTION test(… > > > > CREATE FUNCTION myschema.test( > > > > *From:* intmail01 <[email protected]> > *Sent:* Tuesday, January 9, 2024 12:15 AM > *To:* [email protected] > *Subject:* [EXTERNAL] How to use one function which can be accessed for > all schemas > > > > Hi, > > > > I have several schemas in my database, I want to create just one function > to use with all these schema. > > I create the function in a main schema then the trigger call the function > and error occurs : "No function matches the given name and argument types. > You might need to add explicit type casts." > > > > How to use just one function which can be work amongst all shemas in the > db ? > > My objective is to reduce update of functions code just once not for many > schemas. I dont want to duplicate my functions for each schema. > > > > Thanks > ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to use one function which can be accessed for all schemas @ 2024-01-09 18:38 David G. Johnston <[email protected]> parent: Bindra Bambharoliya <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: David G. Johnston @ 2024-01-09 18:38 UTC (permalink / raw) To: Bindra Bambharoliya <[email protected]>; +Cc: Wetmore, Matthew (CTR) <[email protected]>; intmail01 <[email protected]>; [email protected] On Tue, Jan 9, 2024, 11:09 Bindra Bambharoliya < [email protected]> wrote: > Create function in public or catalog schema. This function will be visible > to each schema and user > Schemas don't have their own visibility, you should not create stuff in pg_catalog, and public is not guaranteed to be in the search_path. And, please do not top-post replies. David J. ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2024-01-09 18:38 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-01-09 08:15 How to use one function which can be accessed for all schemas intmail01 <[email protected]> 2024-01-09 15:29 ` Tom Lane <[email protected]> 2024-01-09 16:39 ` Wetmore, Matthew (CTR) <[email protected]> 2024-01-09 18:09 ` Bindra Bambharoliya <[email protected]> 2024-01-09 18:38 ` David G. Johnston <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox