Ycrux <ycrux@xxxxxxxxxxxxxxxx> writes: > # SELECT grantAccess('sara', 'sarapass'); > ERROR: set-valued function called in context that cannot accept a set You need to do "SELECT * FROM grantAccess(...)". This is a plpgsql implementation restriction that we'll probably try to fix someday, although there's also a school of thought that says that set-returning functions in the SELECT targetlist are a bad idea and should be phased out. regards, tom lane