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

Поиск
Список
Период
Сортировка
От Durumdara
Тема Re: Really unique session ID - PID + connection timestamp?
Дата
Msg-id CAEcMXh=5cDQ8bkCvk9QYH+4s47eWfqTauSXTvCVA00sfXYnH8w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Really unique session ID - PID + connection timestamp?  (John R Pierce <pierce@hogranch.com>)
Список pgsql-general
Dear John!

This is not about MS.

This is about: how to get unique session_id. This could be "pid" + "client starting time".
The pid isn't unique, where I can get "client's starting time"?

But I think the solution is pg_activity view.

There is no same PID as mine, because no one have same subprocess as mine.

So I can filter to my line. This contains my client's starting time.
Anybody's record had same PID in the past can be eliminated.
Other PID's are invalid if were not in it the view.

If Lock_Is_On(aTable, aIDValue, HisPID, HisClientStartTS):

p = GetMyPID
bCanUnlock = False
if p = HisPID:
// This is mine PID - but really mine?
ts = SelectClientStartTSFromActivityLog(p)
if ts = HisClientStartTS:
    
// It's mine
pass
    
else:
  
// The pid is same, but client's starting time is different - we can unlock it, this is not mine
bCanUnlock = True
    
 else:
// This is not mine PID, we can check for existence here
if HaveClientPIDAndStartTSinActivityLog(HisPID, HisTS) = False:
bCanUnlock = True // No one have it, he was off
    
  
if bCanUnlock:
RemoveTableLock(aTable, aID)
else:
raise Exception('Cannot lock the object because locked by another user!')


Thanks for your inspiration!


2016-04-09 12:30 GMT+02:00 John R Pierce <pierce@hogranch.com>:
On 4/9/2016 1:30 AM, Durumdara wrote:
In MS we had...

If you want Microsoft's unique version of SQL, run Microsoft SQL. That stuff you describe is a whole bunch of implementation specific wierdness from the standpoint of someone outside, looking in..




--
john r pierce, recycling bits in santa cruz



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Really unique session ID - PID + connection timestamp?
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Really unique session ID - PID + connection timestamp?