Replace errdetail("%s", ...) with errdetail_internal("%s", ...).
There may be some other places where we should use errdetail_internal, but they'll have to be evaluated case-by-case. This commit just hits a bunch of places where invoking gettext is obviously a waste of cycles.
This commit is contained in:
parent
3ee7c8710d
commit
1af37ec96d
|
@ -188,7 +188,7 @@ typedef struct remoteConnHashEnt
|
|||
ereport(ERROR, \
|
||||
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), \
|
||||
errmsg("could not establish connection"), \
|
||||
errdetail("%s", msg))); \
|
||||
errdetail_internal("%s", msg))); \
|
||||
} \
|
||||
dblink_security_check(conn, rconn); \
|
||||
PQsetClientEncoding(conn, GetDatabaseEncodingName()); \
|
||||
|
@ -264,7 +264,7 @@ dblink_connect(PG_FUNCTION_ARGS)
|
|||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
|
||||
errmsg("could not establish connection"),
|
||||
errdetail("%s", msg)));
|
||||
errdetail_internal("%s", msg)));
|
||||
}
|
||||
|
||||
/* check password actually used if not superuser */
|
||||
|
@ -2262,8 +2262,9 @@ dblink_res_error(const char *conname, PGresult *res, const char *dblink_context_
|
|||
|
||||
ereport(level,
|
||||
(errcode(sqlstate),
|
||||
message_primary ? errmsg("%s", message_primary) : errmsg("unknown error"),
|
||||
message_detail ? errdetail("%s", message_detail) : 0,
|
||||
message_primary ? errmsg_internal("%s", message_primary) :
|
||||
errmsg("unknown error"),
|
||||
message_detail ? errdetail_internal("%s", message_detail) : 0,
|
||||
message_hint ? errhint("%s", message_hint) : 0,
|
||||
message_context ? errcontext("%s", message_context) : 0,
|
||||
errcontext("Error occurred on dblink connection named \"%s\": %s.",
|
||||
|
|
|
@ -902,7 +902,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
|
|||
ereport(NOTICE,
|
||||
(errmsg("ignoring incomplete trigger group for constraint \"%s\" %s",
|
||||
constr_name, buf.data),
|
||||
errdetail("%s", _(funcdescr[funcnum]))));
|
||||
errdetail_internal("%s", _(funcdescr[funcnum]))));
|
||||
oldContext = MemoryContextSwitchTo(TopMemoryContext);
|
||||
info = (OldTriggerInfo *) palloc0(sizeof(OldTriggerInfo));
|
||||
info->args = copyObject(stmt->args);
|
||||
|
@ -918,7 +918,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
|
|||
ereport(NOTICE,
|
||||
(errmsg("ignoring incomplete trigger group for constraint \"%s\" %s",
|
||||
constr_name, buf.data),
|
||||
errdetail("%s", _(funcdescr[funcnum]))));
|
||||
errdetail_internal("%s", _(funcdescr[funcnum]))));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -930,7 +930,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
|
|||
ereport(NOTICE,
|
||||
(errmsg("converting trigger group into constraint \"%s\" %s",
|
||||
constr_name, buf.data),
|
||||
errdetail("%s", _(funcdescr[funcnum]))));
|
||||
errdetail_internal("%s", _(funcdescr[funcnum]))));
|
||||
fkcon->contype = CONSTR_FOREIGN;
|
||||
fkcon->location = -1;
|
||||
if (funcnum == 2)
|
||||
|
|
|
@ -953,7 +953,7 @@ DropRole(DropRoleStmt *stmt)
|
|||
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
|
||||
errmsg("role \"%s\" cannot be dropped because some objects depend on it",
|
||||
role),
|
||||
errdetail("%s", detail),
|
||||
errdetail_internal("%s", detail),
|
||||
errdetail_log("%s", detail_log)));
|
||||
|
||||
/*
|
||||
|
|
|
@ -955,7 +955,7 @@ pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
|
|||
*/
|
||||
ereport(severity,
|
||||
(errmsg_internal("%s", errmsg),
|
||||
errdetail("%s: %s", msg_major, msg_minor)));
|
||||
errdetail_internal("%s: %s", msg_major, msg_minor)));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1198,11 +1198,11 @@ pg_SSPI_error(int severity, const char *errmsg, SECURITY_STATUS r)
|
|||
sysmsg, sizeof(sysmsg), NULL) == 0)
|
||||
ereport(severity,
|
||||
(errmsg_internal("%s", errmsg),
|
||||
errdetail("SSPI error %x", (unsigned int) r)));
|
||||
errdetail_internal("SSPI error %x", (unsigned int) r)));
|
||||
else
|
||||
ereport(severity,
|
||||
(errmsg_internal("%s", errmsg),
|
||||
errdetail("%s (%x)", sysmsg, (unsigned int) r)));
|
||||
errdetail_internal("%s (%x)", sysmsg, (unsigned int) r)));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -82,7 +82,7 @@ elog_node_display(int lev, const char *title, void *obj, bool pretty)
|
|||
pfree(s);
|
||||
ereport(lev,
|
||||
(errmsg_internal("%s:", title),
|
||||
errdetail("%s", f)));
|
||||
errdetail_internal("%s", f)));
|
||||
pfree(f);
|
||||
}
|
||||
|
||||
|
|
|
@ -939,7 +939,7 @@ DeadLockReport(void)
|
|||
ereport(ERROR,
|
||||
(errcode(ERRCODE_T_R_DEADLOCK_DETECTED),
|
||||
errmsg("deadlock detected"),
|
||||
errdetail("%s", clientbuf.data),
|
||||
errdetail_internal("%s", clientbuf.data),
|
||||
errdetail_log("%s", logbuf.data),
|
||||
errhint("See server log for query details.")));
|
||||
}
|
||||
|
|
|
@ -4294,7 +4294,7 @@ ShowUsage(const char *title)
|
|||
|
||||
ereport(LOG,
|
||||
(errmsg_internal("%s", title),
|
||||
errdetail("%s", str.data)));
|
||||
errdetail_internal("%s", str.data)));
|
||||
|
||||
pfree(str.data);
|
||||
}
|
||||
|
|
|
@ -1364,14 +1364,14 @@ xml_ereport(int level, int sqlcode, const char *msg)
|
|||
|
||||
ereport(level,
|
||||
(errcode(sqlcode),
|
||||
errmsg("%s", msg),
|
||||
errdetail("%s", detail)));
|
||||
errmsg_internal("%s", msg),
|
||||
errdetail_internal("%s", detail)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ereport(level,
|
||||
(errcode(sqlcode),
|
||||
errmsg("%s", msg)));
|
||||
errmsg_internal("%s", msg)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1442,7 +1442,7 @@ xml_ereport_by_code(int level, int sqlcode,
|
|||
|
||||
ereport(level,
|
||||
(errcode(sqlcode),
|
||||
errmsg("%s", msg),
|
||||
errmsg_internal("%s", msg),
|
||||
errdetail(det, code)));
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ incompatible_module_error(const char *libname,
|
|||
ereport(ERROR,
|
||||
(errmsg("incompatible library \"%s\": magic block mismatch",
|
||||
libname),
|
||||
errdetail("%s", details.data)));
|
||||
errdetail_internal("%s", details.data)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -7975,11 +7975,11 @@ call_bool_check_hook(struct config_bool * conf, bool *newval, void **extra,
|
|||
ereport(elevel,
|
||||
(errcode(GUC_check_errcode_value),
|
||||
GUC_check_errmsg_string ?
|
||||
errmsg("%s", GUC_check_errmsg_string) :
|
||||
errmsg_internal("%s", GUC_check_errmsg_string) :
|
||||
errmsg("invalid value for parameter \"%s\": %d",
|
||||
conf->gen.name, (int) *newval),
|
||||
GUC_check_errdetail_string ?
|
||||
errdetail("%s", GUC_check_errdetail_string) : 0,
|
||||
errdetail_internal("%s", GUC_check_errdetail_string) : 0,
|
||||
GUC_check_errhint_string ?
|
||||
errhint("%s", GUC_check_errhint_string) : 0));
|
||||
/* Flush any strings created in ErrorContext */
|
||||
|
@ -8009,11 +8009,11 @@ call_int_check_hook(struct config_int * conf, int *newval, void **extra,
|
|||
ereport(elevel,
|
||||
(errcode(GUC_check_errcode_value),
|
||||
GUC_check_errmsg_string ?
|
||||
errmsg("%s", GUC_check_errmsg_string) :
|
||||
errmsg_internal("%s", GUC_check_errmsg_string) :
|
||||
errmsg("invalid value for parameter \"%s\": %d",
|
||||
conf->gen.name, *newval),
|
||||
GUC_check_errdetail_string ?
|
||||
errdetail("%s", GUC_check_errdetail_string) : 0,
|
||||
errdetail_internal("%s", GUC_check_errdetail_string) : 0,
|
||||
GUC_check_errhint_string ?
|
||||
errhint("%s", GUC_check_errhint_string) : 0));
|
||||
/* Flush any strings created in ErrorContext */
|
||||
|
@ -8043,11 +8043,11 @@ call_real_check_hook(struct config_real * conf, double *newval, void **extra,
|
|||
ereport(elevel,
|
||||
(errcode(GUC_check_errcode_value),
|
||||
GUC_check_errmsg_string ?
|
||||
errmsg("%s", GUC_check_errmsg_string) :
|
||||
errmsg_internal("%s", GUC_check_errmsg_string) :
|
||||
errmsg("invalid value for parameter \"%s\": %g",
|
||||
conf->gen.name, *newval),
|
||||
GUC_check_errdetail_string ?
|
||||
errdetail("%s", GUC_check_errdetail_string) : 0,
|
||||
errdetail_internal("%s", GUC_check_errdetail_string) : 0,
|
||||
GUC_check_errhint_string ?
|
||||
errhint("%s", GUC_check_errhint_string) : 0));
|
||||
/* Flush any strings created in ErrorContext */
|
||||
|
@ -8077,11 +8077,11 @@ call_string_check_hook(struct config_string * conf, char **newval, void **extra,
|
|||
ereport(elevel,
|
||||
(errcode(GUC_check_errcode_value),
|
||||
GUC_check_errmsg_string ?
|
||||
errmsg("%s", GUC_check_errmsg_string) :
|
||||
errmsg_internal("%s", GUC_check_errmsg_string) :
|
||||
errmsg("invalid value for parameter \"%s\": \"%s\"",
|
||||
conf->gen.name, *newval ? *newval : ""),
|
||||
GUC_check_errdetail_string ?
|
||||
errdetail("%s", GUC_check_errdetail_string) : 0,
|
||||
errdetail_internal("%s", GUC_check_errdetail_string) : 0,
|
||||
GUC_check_errhint_string ?
|
||||
errhint("%s", GUC_check_errhint_string) : 0));
|
||||
/* Flush any strings created in ErrorContext */
|
||||
|
@ -8111,12 +8111,12 @@ call_enum_check_hook(struct config_enum * conf, int *newval, void **extra,
|
|||
ereport(elevel,
|
||||
(errcode(GUC_check_errcode_value),
|
||||
GUC_check_errmsg_string ?
|
||||
errmsg("%s", GUC_check_errmsg_string) :
|
||||
errmsg_internal("%s", GUC_check_errmsg_string) :
|
||||
errmsg("invalid value for parameter \"%s\": \"%s\"",
|
||||
conf->gen.name,
|
||||
config_enum_lookup_by_value(conf, *newval)),
|
||||
GUC_check_errdetail_string ?
|
||||
errdetail("%s", GUC_check_errdetail_string) : 0,
|
||||
errdetail_internal("%s", GUC_check_errdetail_string) : 0,
|
||||
GUC_check_errhint_string ?
|
||||
errhint("%s", GUC_check_errhint_string) : 0));
|
||||
/* Flush any strings created in ErrorContext */
|
||||
|
|
|
@ -2792,7 +2792,7 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
|
|||
ereport(stmt->elog_level,
|
||||
(err_code ? errcode(err_code) : 0,
|
||||
errmsg_internal("%s", err_message),
|
||||
(err_detail != NULL) ? errdetail("%s", err_detail) : 0,
|
||||
(err_detail != NULL) ? errdetail_internal("%s", err_detail) : 0,
|
||||
(err_hint != NULL) ? errhint("%s", err_hint) : 0));
|
||||
|
||||
estate->err_text = NULL; /* un-suppress... */
|
||||
|
|
|
@ -4435,8 +4435,8 @@ PLy_elog(int elevel, const char *fmt,...)
|
|||
PG_TRY();
|
||||
{
|
||||
ereport(elevel,
|
||||
(errmsg("%s", primary ? primary : "no exception data"),
|
||||
(detail) ? errdetail("%s", detail) : 0,
|
||||
(errmsg_internal("%s", primary ? primary : "no exception data"),
|
||||
(detail) ? errdetail_internal("%s", detail) : 0,
|
||||
(tb_depth > 0 && tbmsg) ? errcontext("%s", tbmsg) : 0,
|
||||
(hint) ? errhint("%s", hint) : 0,
|
||||
(query) ? internalerrquery(query) : 0,
|
||||
|
|
Loading…
Reference in New Issue