X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F5D23A3E94 for ; Wed, 17 Nov 2004 14:45:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90458-03 for ; Wed, 17 Nov 2004 14:44:54 +0000 (GMT) Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id F3D243A3E44 for ; Wed, 17 Nov 2004 14:44:57 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1CUR3G-0003g5-L8; Wed, 17 Nov 2004 14:44:54 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id E28E4172CA; Wed, 17 Nov 2004 14:44:51 +0000 (GMT) Message-ID: <419B63E3.5040900@archonet.com> Date: Wed, 17 Nov 2004 14:44:51 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Achilleus Mantzios Cc: abief_ag_-postgresql@yahoo.com, pgsql-sql@postgresql.org Subject: Re: session_id References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/173 X-Sequence-Number: 19492 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