/* *AddSQLSTATEerrorcodetothecurrentconflictreport.
*/ staticint
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);
}
/* First, construct a detailed message describing the type of conflict */ switch (type)
{ case CT_INSERT_EXISTS: case CT_UPDATE_EXISTS: case CT_MULTIPLE_UNIQUE_CONFLICTS:
Assert(OidIsValid(indexoid) &&
CheckRelationOidLockedByMe(indexoid, RowExclusiveLock, true));
if (localts)
{ if (localorigin == InvalidRepOriginId)
appendStringInfo(&err_detail, _("Key already exists in unique index \"%s\", modified locally in transaction %u at %s."),
get_rel_name(indexoid),
localxmin, timestamptz_to_str(localts)); elseif (replorigin_by_oid(localorigin, true, &origin_name))
appendStringInfo(&err_detail, _("Key already exists in unique index \"%s\", modified by origin \"%s\" in transaction %u at %s."),
get_rel_name(indexoid), origin_name,
localxmin, timestamptz_to_str(localts));
/* *Theoriginthatmodifiedthisrowhasbeenremoved.This *canhappeniftheoriginwascreatedbyadifferentapply *workeranditsassociatedsubscriptionandoriginwere *droppedafterupdatingtherow,oriftheoriginwas *manuallydroppedbytheuser.
*/ else
appendStringInfo(&err_detail, _("Key already exists in unique index \"%s\", modified by a non-existent origin in transaction %u at %s."),
get_rel_name(indexoid),
localxmin, timestamptz_to_str(localts));
} else
appendStringInfo(&err_detail, _("Key already exists in unique index \"%s\", modified in transaction %u."),
get_rel_name(indexoid), localxmin);
break;
case CT_UPDATE_ORIGIN_DIFFERS: if (localorigin == InvalidRepOriginId)
appendStringInfo(&err_detail, _("Updating the row that was modified locally in transaction %u at %s."),
localxmin, timestamptz_to_str(localts)); elseif (replorigin_by_oid(localorigin, true, &origin_name))
appendStringInfo(&err_detail, _("Updating the row that was modified by a different origin \"%s\" in transaction %u at %s."),
origin_name, localxmin, timestamptz_to_str(localts));
/* The origin that modified this row has been removed. */ else
appendStringInfo(&err_detail, _("Updating the row that was modified by a non-existent origin in transaction %u at %s."),
localxmin, timestamptz_to_str(localts));
break;
case CT_UPDATE_MISSING:
appendStringInfoString(&err_detail, _("Could not find the row to be updated.")); break;
case CT_DELETE_ORIGIN_DIFFERS: if (localorigin == InvalidRepOriginId)
appendStringInfo(&err_detail, _("Deleting the row that was modified locally in transaction %u at %s."),
localxmin, timestamptz_to_str(localts)); elseif (replorigin_by_oid(localorigin, true, &origin_name))
appendStringInfo(&err_detail, _("Deleting the row that was modified by a different origin \"%s\" in transaction %u at %s."),
origin_name, localxmin, timestamptz_to_str(localts));
/* The origin that modified this row has been removed. */ else
appendStringInfo(&err_detail, _("Deleting the row that was modified by a non-existent origin in transaction %u at %s."),
localxmin, timestamptz_to_str(localts));
break;
case CT_DELETE_MISSING:
appendStringInfoString(&err_detail, _("Could not find the row to be deleted.")); break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.