Oliver Elphick <olly(at)lfix(dot)co(dot)uk> writes:
> Perhaps instead you should look into IP-tunnelling into the PostgreSQL
> server through ssh. I think your aim should be not to run psql on the
> server at all.
I agree. psql is meant to be run by the user, ie with end-user
permissions. Trying to force it to be secure is swimming against
the tide. Run it on the client side with the client's permissions,
or don't use it at all (there are plenty of alternatives...)
regards, tom lane