Question on error code selection in conflict detection

Поиск
Список
Период
Сортировка
От Dilip Kumar
Тема Question on error code selection in conflict detection
Дата
Msg-id CAFiTN-vJrGgQu0WkY2uRd5bORrUfJKczHUoVMzC4L1oLaCh77Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Question on error code selection in conflict detection
Re: Question on error code selection in conflict detection
Re: Question on error code selection in conflict detection
Список pgsql-hackers
Hi,

I was reviewing the code for conflict reporting and became curious
about the choice of ERRCODE_T_R_SERIALIZATION_FAILURE. This error code
typically signifies a serialization failure within a transaction under
serializable isolation, so its use here for a different type of
conflict seems somewhat out of place. I did notice its use in other
contexts for recovery conflicts in physical replication, which also
struck me as a bit unusual.

Given these observations, I'm wondering if it would be more
appropriate to introduce a new, more specific error code for this
purpose?


static int
errcode_apply_conflict(ConflictType type)
{
switch (type)
{
case CT_INSERT_EXISTS:
case CT_UPDATE_EXISTS:
case CT_MULTIPLE_UNIQUE_CONFLICTS:
return errcode(ERRCODE_UNIQUE_VIOLATION);
case CT_UPDATE_ORIGIN_DIFFERS:
case CT_UPDATE_MISSING:
case CT_DELETE_ORIGIN_DIFFERS:
case CT_DELETE_MISSING:
return errcode(ERRCODE_T_R_SERIALIZATION_FAILURE);
}

Assert(false);
return 0; /* silence compiler warning */
}

-- 
Regards,
Dilip Kumar
Google



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