From: | Durumdara <durumdara(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Really unique session ID - PID + connection timestamp? |
Date: | 2016-04-09 11:48:57 |
Message-ID: | CAEcMXh=5cDQ8bkCvk9QYH+4s47eWfqTauSXTvCVA00sfXYnH8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)hogranch(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2016-04-09 11:57:12 | Re: Really unique session ID - PID + connection timestamp? |
Previous Message | Stephen Frost | 2016-04-09 11:42:25 | Re: Really unique session ID - PID + connection timestamp? |