Set Functions Definer Rights

From PostgreSQL wiki

Revision as of 02:56, 5 July 2010 by Adamcscott (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Administrative Snippets

Set Functions to Run under Definer Rights

Works with PostgreSQL

Any version

Written in

sql

Depends on

Nothing


This will set the functions to run under the security privileges as the definer of the function rather than the caller.


update pg_proc 
   set prosecdef = true 
 where proname like '%your function name pattern%';

Setting definer rights allows for the function to have different privileges than the login user. Useful example of how to modify a function via the catalog.

Personal tools