I am migrating from Oracle to Postgres and in oracle we are logging some DB information and looking for the corresponding syntax in Postgres.
The Oracle query is
SELECT sid, serial#, username, machine, osuser
FROM v$session
where sid=SYS_CONTEXT('USERENV','SID')
I can find the pid and the username in postgres:
- I think I don't need the serial# in Postgres as pid can uniquely identify the session
- How to find the machine and osuser in Postgres
Note: I am using Postgres 11.