Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE
| От | Peter Geoghegan | 
|---|---|
| Тема | Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE | 
| Дата | |
| Msg-id | CAM3SWZTU=3NRSepRRU6HhNA_OEvay6mB7c6HiSoKebLmf=zE+w@mail.gmail.com обсуждение исходный текст | 
| Ответ на | Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE (Peter Geoghegan <pg@heroku.com>) | 
| Ответы | Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE | 
| Список | pgsql-hackers | 
On Wed, Jan 15, 2014 at 8:23 PM, Peter Geoghegan <pg@heroku.com> wrote:
> I have an idea of what I could do to fix this, but I don't have time
> to make sure that my hunch is correct.
It might just be a matter of:
@@ -186,6 +186,13 @@ ExecLockHeapTupleForUpdateSpec(EState *estate,    switch (test)    {        case
HeapTupleInvisible:
+            /*
+             * Tuple may have originated from this command, in which case it's
+             * already locked
+             */
+            if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple.t_data))
&&
+                HeapTupleHeaderGetCmin(tuple.t_data) == estate->es_output_cid)
+                return true;            /* Tuple became invisible;  try again */            if
(IsolationUsesXactSnapshot())               ereport(ERROR,
 
-- 
Peter Geoghegan
		
	В списке pgsql-hackers по дате отправления: