Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Tom Lane
Heikki Linnakangas writes: > Sounds complicated. I would go with the GRANT approach. Make my_func() a > SECURITY DEFINER function, and revoke access to my_func_extended() for > all other roles. +1 > Another option to consider is to not expose my_func_extended() at the > SQL level in the first

Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Ayush Vatsa
Understood, Thanks for the help. Regards Ayush >

Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Pavel Stehule
ne 11. 8. 2024 v 15:34 odesílatel Ayush Vatsa napsal: > Thanks for the responses. > > > I would go with the GRANT approach. Make my_func() a > SECURITY DEFINER function, and revoke access to my_func_extended() for > all other roles. > This sounds reasonable, and can be one of the options. > > > D

Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Ayush Vatsa
Thanks for the responses. > I would go with the GRANT approach. Make my_func() a SECURITY DEFINER function, and revoke access to my_func_extended() for all other roles. This sounds reasonable, and can be one of the options. > Dunno how complicated the logic in my_func() is, if that makes sense. A

Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Pavel Stehule
ne 11. 8. 2024 v 14:08 odesílatel Heikki Linnakangas napsal: > On 11/08/2024 12:41, Pavel Stehule wrote: > > ne 11. 8. 2024 v 9:23 odesílatel Ayush Vatsa > > napsal: > > > > Hi PostgreSQL Community, > > > > I have a scenario where I am working with two fu

Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Heikki Linnakangas
On 11/08/2024 12:41, Pavel Stehule wrote: ne 11. 8. 2024 v 9:23 odesílatel Ayush Vatsa > napsal: Hi PostgreSQL Community, I have a scenario where I am working with two functions: one in SQL and another in C, where the SQL function is a wrapper around

Re: Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Pavel Stehule
Hi ne 11. 8. 2024 v 9:23 odesílatel Ayush Vatsa napsal: > Hi PostgreSQL Community, > > I have a scenario where I am working with two functions: one in SQL and > another in C, where the SQL function is a wrapper around C function. Here’s > an example: > > CREATE OR REPLACE FUNCTION my_func(IN inp

Restricting Direct Access to a C Function in PostgreSQL

2024-08-11 Thread Ayush Vatsa
Hi PostgreSQL Community, I have a scenario where I am working with two functions: one in SQL and another in C, where the SQL function is a wrapper around C function. Here’s an example: CREATE OR REPLACE FUNCTION my_func(IN input text)RETURNS BIGINT AS $$DECLARE result BIGINT;BEGIN SELECT