In Oracle, the SYS_CONTEXT function retrieves session and system information from the specified namespace.
In PostgreSQL, you need to use dedicated functions to retrieve each piece of session or system information.
Oracle:
-- Get the current user SELECT SYS_CONTEXT('USERENV', 'SESSION_USER') FROM dual;
PostgreSQL:
-- Get the current user SELECT SESSION_USER;
Mapping SYS_CONTEXT parameters:
| Oracle | PostgreSQL | |||
| 1 | SYS_CONTEXT('USERENV', 'IP_ADDRESS') | User IP | INET_CLIENT_ADDR() | |
| 2 | SYS_CONTEXT('USERENV', 'SESSION_USER') | Current user | SESSION_USER | |
For more information, see Oracle to PostgreSQL Migration.