How to get OS user in Postgres?
PostgreSQL has few functions reporting information on the client environment, listed at 
https://www.postgresql.org/docs/current/static/functions-info.html

Concerning the remote IP address, it provides inet_client_addr().

Concerning the client username, I don't think it has this information at all, because it's not passed at connection time, unless it happens to be the same as the database user name, but the backend can't know that in general.

If the SQL functions need that information,it could be passed up front by your applications in the form of a SET statement. Current versions of PostgreSQL allow to instantiate any namespace for custom variables.

Example with version 9.3:

test=&gt; set session.osuser to 'daniel';
SET

test=&gt; show session.osuser;
 session.osuser 
----------------
 daniel
(1 row)

test=&gt; select current_setting('session.osuser');
 current_setting 
-----------------
 daniel
(1 row)