Nicolas Kowalski <Nicolas.Kowalski@imag.fr> writes:
> - if the current user is declared as one of the lists maintainers
> ("SELECT maintainer FROM sys_mailing_lists;"), he(she) will be able to
> SELECT, INSERT, UPDATE & DELETE rows in the 'sys_mailing_members' table,
> - if not he(she) will only be able to do SELECT's on
> 'sys_mailing_members'.
Why do you need to build this from spare parts? Use GRANT. Possibly
create a GROUP to list the maintainers (makes life easier if the same
set of users should have similar permissions on multiple tables).
regards, tom lane