On 12 Mar 2002, Lars Preben S. Arnesen wrote:
> I'm writing a web application to access a Postgres database. I want
> the application to use a user with limited permissions - it should
> only be able to execute predefined functions in the database.
>
> I have been searching for the Postgres-way of doing this, but I din't
> find any solution.
>
> I have designed functions with pl/pgsql which do alter, insert, select
> and delete in the database, but I don't want the database user to be
> able to perform these actions without using the predefined functions.
>
> How can I do this?
Well, I'm not sure you can using only pl/pgsql, but if you don't grant
access to any of the tables, I know that in C you can have functions run
queries as a different user. However I'm not sure how well that'll
work for things that you want to return result sets (you could make
temp tables that the user has access to for that I guess)