Current PID in Postgres

This returns the PID of the current psql session:

select pg_backend_pid()