From: Richard Huxton <dev@archonet.com>
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: abief_ag_-postgresql@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: session_id
Date: Wed, 17 Nov 2004 14:44:51 +0000
Message-ID: <419B63E3.5040900@archonet.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0411171629170.8373-100000@matrix.gatewaynet.com>
References: <Pine.LNX.4.44.0411171629170.8373-100000@matrix.gatewaynet.com>
Achilleus Mantzios wrote:
> O Richard Huxton Ýãñáøå óôéò Nov 17, 2004 :
>
>
>>Riccardo G. Facchini wrote:
>>
>>>hi all,
>>>
>>>is there a way to determine the session id on a database session?
>>>
>>>I would need to have a unique number whenever a session is started, and
>>>have this available as a function or view result.
>
>
> Why not SELECT pg_backend_pid();
> ??
This is guaranteed to be unique while connected, but if you want to
track sessions over time isn't guaranteed to be. So, if you might have
pid=1234 now and also a month ago in a different session (especially if
you had a server reboot in-between).
Of course, if Riccardo doesn't need that, the pid is fine.
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, achill@matrix.gatewaynet.com, abief_ag_-postgresql@yahoo.com
Subject: Re: session_id
In-Reply-To: <419B63E3.5040900@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox