Skip site navigation (1) Skip section navigation (2)

Re: session id and global storage

From: "Rodrigo De Leon" <rdeleonp(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: session id and global storage
Date: 2006-06-29 13:12:20
Message-ID: a55915760606290612t78415910xc0a91046192e9eed@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
>>> Hi, I cant find any function, which tells me something like session
>>> id. Is there something like that? I need it in my AM, because I need
>>> to know, if something which I wrote in file was written in this
>>> current session or previously.
>>
>> How about
>> select procpid||' '||backend_start from pg_stat_activity;
>> Yours,
>> Laurenz Albe
>
>Something like this would be maybe possible, but this select can
>return more rows, when the user is connected with more instances...
>
>David Hoksza

You could do this:

	SELECT procpid||' '||backend_start
	FROM pg_stat_activity
	WHERE datname = current_database()
	AND usename = session_user
	AND client_addr = inet_client_addr()
	AND client_port = inet_client_port();

Regards,

Rodrigo

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2006-06-29 13:44:13
Subject: Re: session id and global storage
Previous:From: Nikolay SamokhvalovDate: 2006-06-29 12:48:01
Subject: Some questions to developers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group