Uniquely identify a connection?

Started by Steve Krallover 24 years ago2 messagesgeneral
Jump to latest
#1Steve Krall
swalker@iglou.com

Is there a way in postgres to uniquely identify a connection? ie - get
something like the process id ?

select pid();

Thanks
Steve

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Steve Krall (#1)
Re: Uniquely identify a connection?

swalker@iglou.com writes:

Is there a way in postgres to uniquely identify a connection? ie - get
something like the process id ?

No, but you can easily write your own: (Made up from memory, syntax
details may vary.)

PG_FUNCTION_INFO_V1(sql_getpid);

Datum
sql_getpid(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32((int32)getpid());
}

Declare as

CREATE FUNCTION pid() RETURNS integer AS 'filename here', 'sql_getpid'
LANGUAGE 'C';

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter