Re: Really unique session ID - PID + connection timestamp? - Mailing list pgsql-general

From Christoph Berg
Subject Re: Really unique session ID - PID + connection timestamp?
Date
Msg-id 20160409124003.GA2719@msg.df7cb.de
Whole thread Raw
In response to Re: Really unique session ID - PID + connection timestamp?  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Really unique session ID - PID + connection timestamp?
List pgsql-general
Re: Stephen Frost 2016-04-09 <20160409115712.GT10850@tamriel.snowman.net>
> > Btw, what you are describing is exactly what %c in log_line_prefix
> > does.
>
> That's not currently exposed at an SQL level anywhere though, is it?
> Perhaps we should add a way to get that.  Another thought would be to
> essentially expose 'log_line_prefix()' at the SQL level but I'm not sure
> that generally makes sense.  We could also have an explicit function to
> get MyStartTime, similar to pg_backend_pid().

I don't see how log_line_prefix() would make sense, but
pg_session_identifier() (= %c) would make sense to have, in the same
way that we have pg_backend_pid(), so the current session could be
located in the logs. (Not sure if pg_session_identifier shouldn't also
be a pg_stat_activity column, but that might be overkill. Maybe
SELECT pg_session_identifier(pid) from pg_stat_activity; ?)

MyStartTime is probably too specific.

Christoph


pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Really unique session ID - PID + connection timestamp?
Next
From: Adrian Klaver
Date:
Subject: Re: 9.5 - Is there any way to disable automatic rollback?