"Tumurbaatar S." <tumurbaatar(at)datacom(dot)mn> writes:
> The following function returns this error:
> pg_query(): Query failed: ERROR: permission denied for relation customers
> CONTEXT: PL/pgSQL function "newprofile" line 8 at SQL statement
> What is wrong here?
By default functions execute with the permissions of the calling user.
If that's not what you want, see the SECURITY DEFINER option of CREATE
FUNCTION.
regards, tom lane