It is possible using the session_exec extension to postgresql to run a single function at session creation time
CREATE FUNCTION workon(venv text) RETURNS void
LANGUAGE plpythonu
AS $_$
import os
import sys
if sys.platform in ('win32', 'win64', 'cygwin'):
activate_this = os.path.join(venv, 'Scripts', 'activate_this.py')
else:
if not os.environ.has_key('PATH'):
import subprocess
p=subprocess.Popen('echo -n $PATH', stdout=subprocess.PIPE, shell=True)
(mypath,err) = p.communicate()
os.environ['PATH'] = mypath
activate_this = os.path.join(venv, 'bin', 'activate_this.py')
exec(open(activate_this).read(), dict(__file__=activate_this))
$_$;