Commit c302a613 authored by Peter Eisentraut's avatar Peter Eisentraut

Error message refactoring

Take some untranslatable things out of the message and replace by
format placeholders, to reduce translatable strings and reduce
translation mistakes.
parent dcffc9ba
...@@ -865,7 +865,8 @@ begin_prepare_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn) ...@@ -865,7 +865,8 @@ begin_prepare_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn)
if (ctx->callbacks.begin_prepare_cb == NULL) if (ctx->callbacks.begin_prepare_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical replication at prepare time requires begin_prepare_cb callback"))); errmsg("logical replication at prepare time requires a %s callback",
"begin_prepare_cb")));
/* do the actual work: call callback */ /* do the actual work: call callback */
ctx->callbacks.begin_prepare_cb(ctx, txn); ctx->callbacks.begin_prepare_cb(ctx, txn);
...@@ -908,7 +909,8 @@ prepare_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -908,7 +909,8 @@ prepare_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.prepare_cb == NULL) if (ctx->callbacks.prepare_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical replication at prepare time requires prepare_cb callback"))); errmsg("logical replication at prepare time requires a %s callback",
"prepare_cb")));
/* do the actual work: call callback */ /* do the actual work: call callback */
ctx->callbacks.prepare_cb(ctx, txn, prepare_lsn); ctx->callbacks.prepare_cb(ctx, txn, prepare_lsn);
...@@ -951,7 +953,8 @@ commit_prepared_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -951,7 +953,8 @@ commit_prepared_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.commit_prepared_cb == NULL) if (ctx->callbacks.commit_prepared_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical replication at prepare time requires commit_prepared_cb callback"))); errmsg("logical replication at prepare time requires a %s callback",
"commit_prepared_cb")));
/* do the actual work: call callback */ /* do the actual work: call callback */
ctx->callbacks.commit_prepared_cb(ctx, txn, commit_lsn); ctx->callbacks.commit_prepared_cb(ctx, txn, commit_lsn);
...@@ -995,7 +998,8 @@ rollback_prepared_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -995,7 +998,8 @@ rollback_prepared_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.rollback_prepared_cb == NULL) if (ctx->callbacks.rollback_prepared_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical replication at prepare time requires rollback_prepared_cb callback"))); errmsg("logical replication at prepare time requires a %s callback",
"rollback_prepared_cb")));
/* do the actual work: call callback */ /* do the actual work: call callback */
ctx->callbacks.rollback_prepared_cb(ctx, txn, prepare_end_lsn, ctx->callbacks.rollback_prepared_cb(ctx, txn, prepare_end_lsn,
...@@ -1217,7 +1221,8 @@ stream_start_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -1217,7 +1221,8 @@ stream_start_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.stream_start_cb == NULL) if (ctx->callbacks.stream_start_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical streaming requires a stream_start_cb callback"))); errmsg("logical streaming requires a %s callback",
"stream_start_cb")));
ctx->callbacks.stream_start_cb(ctx, txn); ctx->callbacks.stream_start_cb(ctx, txn);
...@@ -1263,7 +1268,8 @@ stream_stop_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -1263,7 +1268,8 @@ stream_stop_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.stream_stop_cb == NULL) if (ctx->callbacks.stream_stop_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical streaming requires a stream_stop_cb callback"))); errmsg("logical streaming requires a %s callback",
"stream_stop_cb")));
ctx->callbacks.stream_stop_cb(ctx, txn); ctx->callbacks.stream_stop_cb(ctx, txn);
...@@ -1302,7 +1308,8 @@ stream_abort_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -1302,7 +1308,8 @@ stream_abort_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.stream_abort_cb == NULL) if (ctx->callbacks.stream_abort_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical streaming requires a stream_abort_cb callback"))); errmsg("logical streaming requires a %s callback",
"stream_abort_cb")));
ctx->callbacks.stream_abort_cb(ctx, txn, abort_lsn); ctx->callbacks.stream_abort_cb(ctx, txn, abort_lsn);
...@@ -1345,7 +1352,8 @@ stream_prepare_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -1345,7 +1352,8 @@ stream_prepare_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.stream_prepare_cb == NULL) if (ctx->callbacks.stream_prepare_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical streaming at prepare time requires a stream_prepare_cb callback"))); errmsg("logical streaming at prepare time requires a %s callback",
"stream_prepare_cb")));
ctx->callbacks.stream_prepare_cb(ctx, txn, prepare_lsn); ctx->callbacks.stream_prepare_cb(ctx, txn, prepare_lsn);
...@@ -1384,7 +1392,8 @@ stream_commit_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -1384,7 +1392,8 @@ stream_commit_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.stream_commit_cb == NULL) if (ctx->callbacks.stream_commit_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical streaming requires a stream_commit_cb callback"))); errmsg("logical streaming requires a %s callback",
"stream_commit_cb")));
ctx->callbacks.stream_commit_cb(ctx, txn, commit_lsn); ctx->callbacks.stream_commit_cb(ctx, txn, commit_lsn);
...@@ -1430,7 +1439,8 @@ stream_change_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, ...@@ -1430,7 +1439,8 @@ stream_change_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn,
if (ctx->callbacks.stream_change_cb == NULL) if (ctx->callbacks.stream_change_cb == NULL)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical streaming requires a stream_change_cb callback"))); errmsg("logical streaming requires a %s callback",
"stream_change_cb")));
ctx->callbacks.stream_change_cb(ctx, txn, relation, change); ctx->callbacks.stream_change_cb(ctx, txn, relation, change);
......
...@@ -2274,7 +2274,8 @@ serialize_expr_stats(AnlExprData *exprdata, int nexprs) ...@@ -2274,7 +2274,8 @@ serialize_expr_stats(AnlExprData *exprdata, int nexprs)
if (!OidIsValid(typOid)) if (!OidIsValid(typOid))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("relation \"pg_statistic\" does not have a composite type"))); errmsg("relation \"%s\" does not have a composite type",
"pg_statistic")));
for (exprno = 0; exprno < nexprs; exprno++) for (exprno = 0; exprno < nexprs; exprno++)
{ {
......
...@@ -4182,11 +4182,11 @@ numeric_int4_opt_error(Numeric num, bool *have_error) ...@@ -4182,11 +4182,11 @@ numeric_int4_opt_error(Numeric num, bool *have_error)
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert NaN to integer"))); errmsg("cannot convert NaN to %s", "integer")));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert infinity to integer"))); errmsg("cannot convert infinity to %s", "integer")));
} }
} }
...@@ -4260,11 +4260,11 @@ numeric_int8(PG_FUNCTION_ARGS) ...@@ -4260,11 +4260,11 @@ numeric_int8(PG_FUNCTION_ARGS)
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert NaN to bigint"))); errmsg("cannot convert NaN to %s", "bigint")));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert infinity to bigint"))); errmsg("cannot convert infinity to %s", "bigint")));
} }
/* Convert to variable format and thence to int8 */ /* Convert to variable format and thence to int8 */
...@@ -4301,11 +4301,11 @@ numeric_int2(PG_FUNCTION_ARGS) ...@@ -4301,11 +4301,11 @@ numeric_int2(PG_FUNCTION_ARGS)
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert NaN to smallint"))); errmsg("cannot convert NaN to %s", "smallint")));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert infinity to smallint"))); errmsg("cannot convert infinity to %s", "smallint")));
} }
/* Convert to variable format and thence to int8 */ /* Convert to variable format and thence to int8 */
...@@ -4496,11 +4496,11 @@ numeric_pg_lsn(PG_FUNCTION_ARGS) ...@@ -4496,11 +4496,11 @@ numeric_pg_lsn(PG_FUNCTION_ARGS)
if (NUMERIC_IS_NAN(num)) if (NUMERIC_IS_NAN(num))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert NaN to pg_lsn"))); errmsg("cannot convert NaN to %s", "pg_lsn")));
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert infinity to pg_lsn"))); errmsg("cannot convert infinity to %s", "pg_lsn")));
} }
/* Convert to variable format and thence to pg_lsn */ /* Convert to variable format and thence to pg_lsn */
......
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