Re: session id and global storage - Mailing list pgsql-hackers

From Rodrigo De Leon
Subject Re: session id and global storage
Date
Msg-id a55915760606290612t78415910xc0a91046192e9eed@mail.gmail.com
Whole thread Raw
In response to session id and global storage  (David Hoksza <david.hoksza@seznam.cz>)
Responses Re: session id and global storage  (Andrew Dunstan <andrew@dunslane.net>)
List 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_startFROM pg_stat_activityWHERE datname = current_database()AND usename = session_userAND
client_addr= inet_client_addr()AND client_port = inet_client_port();
 

Regards,

Rodrigo


pgsql-hackers by date:

Previous
From: "Nikolay Samokhvalov"
Date:
Subject: Some questions to developers
Next
From: Andrew Dunstan
Date:
Subject: Re: session id and global storage