"Kevin Grittner" <kevin.gritt...@wicourts.gov> wrote: > Alvaro Herrera <alvhe...@commandprompt.com> wrote: >> Excerpts from Tom Lane's message: >> >>> I think that Peter's real concern is whether these are worth >>> translating, and I share that doubt. Perhaps we should invent >>> an errdetail_internal, parallel to errmsg_internal, that works >>> like errdetail but doesn't treat the message as a candidate for >>> translation? >> >> Yeah. The other point is that translated versions of those >> phrases are likely to introduce randomly diverging terms, which >> is not going to help with debugging. As long as the technology >> is new enough that a user is going to need help from -hackers (or >> at least someone who read and grokked README.SSI) to debug a >> problem, there's no benefit to translating those errdetails. > > OK, since that seems to be the consensus, I put a patch together. > Testing it now. Will post once I've confirmed it doesn't break > anything. OK, after getting distracted by test failures caused by an unrelated commit, I've confirmed that this passes my usual tests. I don't know anything about the tools used for extracting the text for the translators, so if that needs any corresponding adjustment, someone will need to point me in the right direction or cover that part separately. The leading whitespace changes in predicate.c are from pgindent. -Kevin
*** a/src/backend/storage/lmgr/predicate.c --- b/src/backend/storage/lmgr/predicate.c *************** *** 3776,3782 **** CheckForSerializableConflictOut(bool visible, Relation relation, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on identification as a pivot, during conflict out checking."), errhint("The transaction might succeed if retried."))); } --- 3776,3782 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on identification as a pivot, during conflict out checking."), errhint("The transaction might succeed if retried."))); } *************** *** 3865,3871 **** CheckForSerializableConflictOut(bool visible, Relation relation, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on conflict out to old pivot %u.", xid), errhint("The transaction might succeed if retried."))); if (SxactHasSummaryConflictIn(MySerializableXact) --- 3865,3871 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on conflict out to old pivot %u.", xid), errhint("The transaction might succeed if retried."))); if (SxactHasSummaryConflictIn(MySerializableXact) *************** *** 3873,3879 **** CheckForSerializableConflictOut(bool visible, Relation relation, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on identification as a pivot, with conflict out to old committed transaction %u.", xid), errhint("The transaction might succeed if retried."))); MySerializableXact->flags |= SXACT_FLAG_SUMMARY_CONFLICT_OUT; --- 3873,3879 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on identification as a pivot, with conflict out to old committed transaction %u.", xid), errhint("The transaction might succeed if retried."))); MySerializableXact->flags |= SXACT_FLAG_SUMMARY_CONFLICT_OUT; *************** *** 3912,3918 **** CheckForSerializableConflictOut(bool visible, Relation relation, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on conflict out to old pivot."), errhint("The transaction might succeed if retried."))); } } --- 3912,3918 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on conflict out to old pivot."), errhint("The transaction might succeed if retried."))); } } *************** *** 4151,4157 **** CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on identification as a pivot, during conflict in checking."), errhint("The transaction might succeed if retried."))); /* --- 4151,4157 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on identification as a pivot, during conflict in checking."), errhint("The transaction might succeed if retried."))); /* *************** *** 4489,4495 **** OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on identification as a pivot, during write."), errhint("The transaction might succeed if retried."))); } else if (SxactIsPrepared(writer)) --- 4489,4495 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on identification as a pivot, during write."), errhint("The transaction might succeed if retried."))); } else if (SxactIsPrepared(writer)) *************** *** 4501,4507 **** OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader, ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on conflict out to pivot %u, during read.", writer->topXid), errhint("The transaction might succeed if retried."))); } writer->flags |= SXACT_FLAG_DOOMED; --- 4501,4507 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on conflict out to pivot %u, during read.", writer->topXid), errhint("The transaction might succeed if retried."))); } writer->flags |= SXACT_FLAG_DOOMED; *************** *** 4543,4549 **** PreCommit_CheckForSerializationFailure(void) ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on identification as a pivot, during commit attempt."), errhint("The transaction might succeed if retried."))); } --- 4543,4549 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on identification as a pivot, during commit attempt."), errhint("The transaction might succeed if retried."))); } *************** *** 4581,4587 **** PreCommit_CheckForSerializationFailure(void) ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail("Canceled on commit attempt with conflict in from prepared pivot."), errhint("The transaction might succeed if retried."))); } nearConflict->sxactOut->flags |= SXACT_FLAG_DOOMED; --- 4581,4587 ---- ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), ! errdetail_internal("Canceled on commit attempt with conflict in from prepared pivot."), errhint("The transaction might succeed if retried."))); } nearConflict->sxactOut->flags |= SXACT_FLAG_DOOMED; *** a/src/backend/utils/error/elog.c --- b/src/backend/utils/error/elog.c *************** *** 843,848 **** errdetail(const char *fmt,...) --- 843,871 ---- /* + * errdetail_internal --- add a detail error message text to the current error + * + * This version has no translation, normally due to technical content. + */ + int + errdetail_internal(const char *fmt,...) + { + ErrorData *edata = &errordata[errordata_stack_depth]; + MemoryContext oldcontext; + + recursion_depth++; + CHECK_STACK_DEPTH(); + oldcontext = MemoryContextSwitchTo(ErrorContext); + + EVALUATE_MESSAGE(detail, false, false); + + MemoryContextSwitchTo(oldcontext); + recursion_depth--; + return 0; /* return value does not matter */ + } + + + /* * errdetail_log --- add a detail_log error message text to the current error */ int *** a/src/include/utils/elog.h --- b/src/include/utils/elog.h *************** *** 147,152 **** errdetail(const char *fmt,...) --- 147,158 ---- __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); extern int + errdetail_internal(const char *fmt,...) + /* This extension allows gcc to check the format string for consistency with + the supplied arguments. */ + __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); + + extern int errdetail_log(const char *fmt,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers