In Oracle, the USERENV function returns information about the current session.
In PostgreSQL, session information must be retrieved using dedicated functions for each specific attribute.
Oracle:
-- Get the current session ID SELECT USERENV('SESSIONID') FROM dual; /* 797676 */
PostgreSQL:
-- Get the current session ID SELECT PG_BACKEND_PID(); /* 50240 */
Mapping USERENV parameters:
| Oracle | PostgreSQL | |||
| 1 | USERENV('SESSIONID') | Get the session ID | PG_BACKEND_PID() | ID values are different |
For more information, see Oracle to PostgreSQL Migration.