Skip to content

Commit c4dcd91

Browse files
committed
Avoid splitting C string literals with \-newline
Using \ is unnecessary and ugly, so remove that. While at it, stitch the literals back into a single line: we've long discouraged splitting error message literals even when they go past the 80 chars line limit, to improve greppability. Leave contrib/tablefunc alone. Discussion: https://postgr.es/m/20191223195156.GA12271@alvherre.pgsql
1 parent cce64a5 commit c4dcd91

File tree

15 files changed

+26
-51
lines changed

15 files changed

+26
-51
lines changed

contrib/dblink/dblink.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,8 +1639,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
16391639
if (src_nitems != pknumatts)
16401640
ereport(ERROR,
16411641
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
1642-
errmsg("source key array length must match number of key " \
1643-
"attributes")));
1642+
errmsg("source key array length must match number of key attributes")));
16441643

16451644
/*
16461645
* Target array is made up of key values that will be used to build the
@@ -1654,8 +1653,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
16541653
if (tgt_nitems != pknumatts)
16551654
ereport(ERROR,
16561655
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
1657-
errmsg("target key array length must match number of key " \
1658-
"attributes")));
1656+
errmsg("target key array length must match number of key attributes")));
16591657

16601658
/*
16611659
* Prep work is finally done. Go get the SQL string.
@@ -1727,8 +1725,7 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
17271725
if (tgt_nitems != pknumatts)
17281726
ereport(ERROR,
17291727
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
1730-
errmsg("target key array length must match number of key " \
1731-
"attributes")));
1728+
errmsg("target key array length must match number of key attributes")));
17321729

17331730
/*
17341731
* Prep work is finally done. Go get the SQL string.
@@ -1807,8 +1804,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
18071804
if (src_nitems != pknumatts)
18081805
ereport(ERROR,
18091806
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
1810-
errmsg("source key array length must match number of key " \
1811-
"attributes")));
1807+
errmsg("source key array length must match number of key attributes")));
18121808

18131809
/*
18141810
* Target array is made up of key values that will be used to build the
@@ -1822,8 +1818,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
18221818
if (tgt_nitems != pknumatts)
18231819
ereport(ERROR,
18241820
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
1825-
errmsg("target key array length must match number of key " \
1826-
"attributes")));
1821+
errmsg("target key array length must match number of key attributes")));
18271822

18281823
/*
18291824
* Prep work is finally done. Go get the SQL string.

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
14151415
if (!(rsinfo->allowedModes & SFRM_Materialize))
14161416
ereport(ERROR,
14171417
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1418-
errmsg("materialize mode required, but it is not " \
1419-
"allowed in this context")));
1418+
errmsg("materialize mode required, but it is not allowed in this context")));
14201419

14211420
/* Switch into long-lived context to construct returned data structures */
14221421
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;

contrib/tablefunc/tablefunc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ crosstab(PG_FUNCTION_ARGS)
373373
if (!(rsinfo->allowedModes & SFRM_Materialize))
374374
ereport(ERROR,
375375
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
376-
errmsg("materialize mode required, but it is not " \
377-
"allowed in this context")));
376+
errmsg("materialize mode required, but it is not allowed in this context")));
378377

379378
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
380379

@@ -650,8 +649,7 @@ crosstab_hash(PG_FUNCTION_ARGS)
650649
rsinfo->expectedDesc == NULL)
651650
ereport(ERROR,
652651
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
653-
errmsg("materialize mode required, but it is not " \
654-
"allowed in this context")));
652+
errmsg("materialize mode required, but it is not allowed in this context")));
655653

656654
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
657655
oldcontext = MemoryContextSwitchTo(per_query_ctx);
@@ -1011,8 +1009,7 @@ connectby_text(PG_FUNCTION_ARGS)
10111009
rsinfo->expectedDesc == NULL)
10121010
ereport(ERROR,
10131011
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1014-
errmsg("materialize mode required, but it is not " \
1015-
"allowed in this context")));
1012+
errmsg("materialize mode required, but it is not allowed in this context")));
10161013

10171014
if (fcinfo->nargs == 6)
10181015
{
@@ -1091,8 +1088,7 @@ connectby_text_serial(PG_FUNCTION_ARGS)
10911088
rsinfo->expectedDesc == NULL)
10921089
ereport(ERROR,
10931090
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1094-
errmsg("materialize mode required, but it is not " \
1095-
"allowed in this context")));
1091+
errmsg("materialize mode required, but it is not allowed in this context")));
10961092

10971093
if (fcinfo->nargs == 7)
10981094
{

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,9 +6135,7 @@ do { \
61356135
if ((currValue) < (minValue)) \
61366136
ereport(ERROR, \
61376137
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
6138-
errmsg("hot standby is not possible because " \
6139-
"%s = %d is a lower setting than on the master server " \
6140-
"(its value was %d)", \
6138+
errmsg("hot standby is not possible because %s = %d is a lower setting than on the master server (its value was %d)", \
61416139
param_name, \
61426140
currValue, \
61436141
minValue))); \

src/backend/access/transam/xlogfuncs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ pg_stop_backup_v2(PG_FUNCTION_ARGS)
186186
if (!(rsinfo->allowedModes & SFRM_Materialize))
187187
ereport(ERROR,
188188
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
189-
errmsg("materialize mode required, but it is not " \
190-
"allowed in this context")));
189+
errmsg("materialize mode required, but it is not allowed in this context")));
191190

192191
/* Build a tuple descriptor for our result type */
193192
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)

src/backend/commands/extension.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,7 @@ pg_available_extensions(PG_FUNCTION_ARGS)
19211921
if (!(rsinfo->allowedModes & SFRM_Materialize))
19221922
ereport(ERROR,
19231923
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1924-
errmsg("materialize mode required, but it is not " \
1925-
"allowed in this context")));
1924+
errmsg("materialize mode required, but it is not allowed in this context")));
19261925

19271926
/* Build a tuple descriptor for our result type */
19281927
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -2030,8 +2029,7 @@ pg_available_extension_versions(PG_FUNCTION_ARGS)
20302029
if (!(rsinfo->allowedModes & SFRM_Materialize))
20312030
ereport(ERROR,
20322031
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2033-
errmsg("materialize mode required, but it is not " \
2034-
"allowed in this context")));
2032+
errmsg("materialize mode required, but it is not allowed in this context")));
20352033

20362034
/* Build a tuple descriptor for our result type */
20372035
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -2254,8 +2252,7 @@ pg_extension_update_paths(PG_FUNCTION_ARGS)
22542252
if (!(rsinfo->allowedModes & SFRM_Materialize))
22552253
ereport(ERROR,
22562254
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2257-
errmsg("materialize mode required, but it is not " \
2258-
"allowed in this context")));
2255+
errmsg("materialize mode required, but it is not allowed in this context")));
22592256

22602257
/* Build a tuple descriptor for our result type */
22612258
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)

src/backend/commands/prepare.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,7 @@ pg_prepared_statement(PG_FUNCTION_ARGS)
714714
if (!(rsinfo->allowedModes & SFRM_Materialize))
715715
ereport(ERROR,
716716
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
717-
errmsg("materialize mode required, but it is not " \
718-
"allowed in this context")));
717+
errmsg("materialize mode required, but it is not allowed in this context")));
719718

720719
/* need to build tuplestore in query context */
721720
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;

src/backend/executor/execExprInterp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,8 +2739,8 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
27392739
if (ndims <= 0 || ndims > MAXDIM)
27402740
ereport(ERROR,
27412741
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
2742-
errmsg("number of array dimensions (%d) exceeds " \
2743-
"the maximum allowed (%d)", ndims, MAXDIM)));
2742+
errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
2743+
ndims, MAXDIM)));
27442744

27452745
elem_dims = (int *) palloc(elem_ndims * sizeof(int));
27462746
memcpy(elem_dims, ARR_DIMS(array), elem_ndims * sizeof(int));

src/backend/libpq/hba.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,8 +2667,7 @@ pg_hba_file_rules(PG_FUNCTION_ARGS)
26672667
if (!(rsi->allowedModes & SFRM_Materialize))
26682668
ereport(ERROR,
26692669
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2670-
errmsg("materialize mode required, but it is not " \
2671-
"allowed in this context")));
2670+
errmsg("materialize mode required, but it is not allowed in this context")));
26722671

26732672
rsi->returnMode = SFRM_Materialize;
26742673

src/backend/replication/logical/launcher.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,7 @@ pg_stat_get_subscription(PG_FUNCTION_ARGS)
10871087
if (!(rsinfo->allowedModes & SFRM_Materialize))
10881088
ereport(ERROR,
10891089
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1090-
errmsg("materialize mode required, but it is not " \
1091-
"allowed in this context")));
1090+
errmsg("materialize mode required, but it is not allowed in this context")));
10921091

10931092
/* Build a tuple descriptor for our result type */
10941093
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)

src/backend/replication/slotfuncs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
237237
if (!(rsinfo->allowedModes & SFRM_Materialize))
238238
ereport(ERROR,
239239
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
240-
errmsg("materialize mode required, but it is not " \
241-
"allowed in this context")));
240+
errmsg("materialize mode required, but it is not allowed in this context")));
242241

243242
/* Build a tuple descriptor for our result type */
244243
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)

src/backend/replication/walsender.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,8 +3196,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
31963196
if (!(rsinfo->allowedModes & SFRM_Materialize))
31973197
ereport(ERROR,
31983198
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3199-
errmsg("materialize mode required, but it is not " \
3200-
"allowed in this context")));
3199+
errmsg("materialize mode required, but it is not allowed in this context")));
32013200

32023201
/* Build a tuple descriptor for our result type */
32033202
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)

src/backend/utils/adt/pgstatfuncs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ pg_stat_get_progress_info(PG_FUNCTION_ARGS)
459459
if (!(rsinfo->allowedModes & SFRM_Materialize))
460460
ereport(ERROR,
461461
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
462-
errmsg("materialize mode required, but it is not " \
463-
"allowed in this context")));
462+
errmsg("materialize mode required, but it is not allowed in this context")));
464463

465464
/* Build a tuple descriptor for our result type */
466465
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -564,8 +563,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
564563
if (!(rsinfo->allowedModes & SFRM_Materialize))
565564
ereport(ERROR,
566565
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
567-
errmsg("materialize mode required, but it is not " \
568-
"allowed in this context")));
566+
errmsg("materialize mode required, but it is not allowed in this context")));
569567

570568
/* Build a tuple descriptor for our result type */
571569
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9507,8 +9507,7 @@ show_all_file_settings(PG_FUNCTION_ARGS)
95079507
if (!(rsinfo->allowedModes & SFRM_Materialize))
95089508
ereport(ERROR,
95099509
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
9510-
errmsg("materialize mode required, but it is not " \
9511-
"allowed in this context")));
9510+
errmsg("materialize mode required, but it is not allowed in this context")));
95129511

95139512
/* Scan the config files using current context as workspace */
95149513
conf = ProcessConfigFileInternal(PGC_SIGHUP, false, DEBUG3);

src/backend/utils/mmgr/portalmem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,8 +1135,7 @@ pg_cursor(PG_FUNCTION_ARGS)
11351135
if (!(rsinfo->allowedModes & SFRM_Materialize))
11361136
ereport(ERROR,
11371137
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1138-
errmsg("materialize mode required, but it is not " \
1139-
"allowed in this context")));
1138+
errmsg("materialize mode required, but it is not allowed in this context")));
11401139

11411140
/* need to build tuplestore in query context */
11421141
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;

0 commit comments

Comments
 (0)