Thread: Uniquely identify a connection?

Uniquely identify a connection?

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

select pid();

Thanks
Steve


Re: Uniquely identify a connection?

From
Peter Eisentraut
Date:
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