Re: Really unique session ID - PID + connection timestamp?

From: Christoph Berg <cb(at)df7cb(dot)de>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Durumdara <durumdara(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Really unique session ID - PID + connection timestamp?
Date: 2016-04-09 12:40:03
Message-ID: 20160409124003.GA2719@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Re: Stephen Frost 2016-04-09 <20160409115712(dot)GT10850(at)tamriel(dot)snowman(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-04-09 13:56:52 Re: 9.5 - Is there any way to disable automatic rollback?
Previous Message Stephen Frost 2016-04-09 11:57:12 Re: Really unique session ID - PID + connection timestamp?