Thread: oracle v$session equivalent in postgresql
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">I’m looking for the equivalent in postgresql to the v$session variables in Oracle. In particular, I needto convert the following statement:</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">select s.program, s.machine into :New.app_name,:New.comp_name from v$session s where s.audsid=userenv('SESSIONID');</span></font><pclass="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy"> </span></font><p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10.0pt;font-family:Arial;color:navy">Any help appreciated</span></font></div>
On Fri, 5 Nov 2004 08:27:58 -0700, stuff@opensourceonline.com <stuff@opensourceonline.com> wrote: > > I'm looking for the equivalent in postgresql to the v$session variables in > Oracle. In particular, I need to convert the following statement: > > select s.program, s.machine into :New.app_name,:New.comp_name from v$session > s where s.audsid=userenv('SESSIONID'); You want basically this information then: SQL> select s.program, s.machine from v$session s where s.audsid=userenv('SESSIONID'); PROGRAM ------------------------------------------------ MACHINE ---------------------------------------------------------------- sqlplus@linux (TNS V1-V3) linux There's no direct equivalent of v$session in PostgreSQL, and I don't know any way of determining the client program name (AFAIK). More information about monitoring user activity can be found e.g. here: http://www.postgresql.org/docs/current/static/monitoring.html Ian Barwick barwick@gmail.com