Commit 1af37ec9 authored by Tom Lane's avatar Tom Lane

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