PostgreSQL - Functions-Body-Security
The most secure way is to revoke the select privilege on the columns.
Then the user will never be able to see the contents no matter what. You can't really hide the body of a function, and you can't hide the table structure from a user (e.g. by querying pg_attribute).
But the information that there is a column named &quot;password&quot; doesn't reveal anything the user didn't know beforehand, so I don't consider this a problem.
A password stored in the database should always be encrypted anyway and with a one way encryption, so it can't be decrypted (e.g. SHA-256).
So even in the extremely unlikely case that the user finds a way to work around the privilege system in Postgres, he would only see the encrypted value and couldn't do anything with it.