Skip to content

Commit 4e89c79

Browse files
committed
Remove excess parens in ereport() calls
Cosmetic cleanup, not worth backpatching. Discussion: https://postgr.es/m/20200129200401.GA6303@alvherre.pgsql Reviewed-by: Tom Lane, Michael Paquier
1 parent 2520cf8 commit 4e89c79

37 files changed

+97
-97
lines changed

contrib/adminpack/adminpack.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ convert_and_check_filename(text *arg, bool logAllowed)
9393
if (path_contains_parent_reference(filename))
9494
ereport(ERROR,
9595
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
96-
(errmsg("reference to parent directory (\"..\") not allowed"))));
96+
errmsg("reference to parent directory (\"..\") not allowed")));
9797

9898
/*
9999
* Allow absolute paths if within DataDir or Log_directory, even
@@ -104,12 +104,12 @@ convert_and_check_filename(text *arg, bool logAllowed)
104104
!path_is_prefix_of_path(Log_directory, filename)))
105105
ereport(ERROR,
106106
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
107-
(errmsg("absolute path not allowed"))));
107+
errmsg("absolute path not allowed")));
108108
}
109109
else if (!path_is_relative_and_below_cwd(filename))
110110
ereport(ERROR,
111111
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
112-
(errmsg("path must be in or below the current directory"))));
112+
errmsg("path must be in or below the current directory")));
113113

114114
return filename;
115115
}
@@ -124,7 +124,7 @@ requireSuperuser(void)
124124
if (!superuser())
125125
ereport(ERROR,
126126
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
127-
(errmsg("only superuser may access generic file functions"))));
127+
errmsg("only superuser may access generic file functions")));
128128
}
129129

130130

@@ -485,7 +485,7 @@ pg_logdir_ls(PG_FUNCTION_ARGS)
485485
if (!superuser())
486486
ereport(ERROR,
487487
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
488-
(errmsg("only superuser can list the log directory"))));
488+
errmsg("only superuser can list the log directory")));
489489

490490
return (pg_logdir_ls_internal(fcinfo));
491491
}
@@ -515,7 +515,7 @@ pg_logdir_ls_internal(FunctionCallInfo fcinfo)
515515
if (strcmp(Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0)
516516
ereport(ERROR,
517517
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
518-
(errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'"))));
518+
errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'")));
519519

520520
if (SRF_IS_FIRSTCALL())
521521
{

contrib/hstore_plperl/hstore_plperl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ plperl_to_hstore(PG_FUNCTION_ARGS)
116116
if (SvTYPE(in) != SVt_PVHV)
117117
ereport(ERROR,
118118
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
119-
(errmsg("cannot transform non-hash Perl value to hstore"))));
119+
errmsg("cannot transform non-hash Perl value to hstore")));
120120
hv = (HV *) in;
121121

122122
pcount = hv_iterinit(hv);

contrib/jsonb_plperl/jsonb_plperl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
235235
if (isinf(nval))
236236
ereport(ERROR,
237237
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
238-
(errmsg("cannot convert infinity to jsonb"))));
238+
errmsg("cannot convert infinity to jsonb")));
239239
if (isnan(nval))
240240
ereport(ERROR,
241241
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
242-
(errmsg("cannot convert NaN to jsonb"))));
242+
errmsg("cannot convert NaN to jsonb")));
243243

244244
out.type = jbvNumeric;
245245
out.val.numeric =
@@ -260,7 +260,7 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
260260
*/
261261
ereport(ERROR,
262262
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
263-
(errmsg("cannot transform this Perl type to jsonb"))));
263+
errmsg("cannot transform this Perl type to jsonb")));
264264
return NULL;
265265
}
266266
}

contrib/jsonb_plpython/jsonb_plpython.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
380380
{
381381
ereport(ERROR,
382382
(errcode(ERRCODE_DATATYPE_MISMATCH),
383-
(errmsg("could not convert value \"%s\" to jsonb", str))));
383+
errmsg("could not convert value \"%s\" to jsonb", str)));
384384
}
385385
PG_END_TRY();
386386

@@ -394,7 +394,7 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
394394
if (numeric_is_nan(num))
395395
ereport(ERROR,
396396
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
397-
(errmsg("cannot convert NaN to jsonb"))));
397+
errmsg("cannot convert NaN to jsonb")));
398398

399399
jbvNum->type = jbvNumeric;
400400
jbvNum->val.numeric = num;
@@ -446,8 +446,8 @@ PLyObject_ToJsonbValue(PyObject *obj, JsonbParseState **jsonb_state, bool is_ele
446446
else
447447
ereport(ERROR,
448448
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
449-
(errmsg("Python type \"%s\" cannot be transformed to jsonb",
450-
PLyObject_AsString((PyObject *) obj->ob_type)))));
449+
errmsg("Python type \"%s\" cannot be transformed to jsonb",
450+
PLyObject_AsString((PyObject *) obj->ob_type))));
451451

452452
/* Push result into 'jsonb_state' unless it is raw scalar value. */
453453
return (*jsonb_state ?

contrib/pageinspect/brinfuncs.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ brin_page_type(PG_FUNCTION_ARGS)
5252
if (!superuser())
5353
ereport(ERROR,
5454
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
55-
(errmsg("must be superuser to use raw page functions"))));
55+
errmsg("must be superuser to use raw page functions")));
5656

5757
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
5858

@@ -141,7 +141,7 @@ brin_page_items(PG_FUNCTION_ARGS)
141141
if (!superuser())
142142
ereport(ERROR,
143143
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
144-
(errmsg("must be superuser to use raw page functions"))));
144+
errmsg("must be superuser to use raw page functions")));
145145

146146
/* check to see if caller supports us returning a tuplestore */
147147
if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
@@ -336,7 +336,7 @@ brin_metapage_info(PG_FUNCTION_ARGS)
336336
if (!superuser())
337337
ereport(ERROR,
338338
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
339-
(errmsg("must be superuser to use raw page functions"))));
339+
errmsg("must be superuser to use raw page functions")));
340340

341341
page = verify_brin_page(raw_page, BRIN_PAGETYPE_META, "metapage");
342342

@@ -374,7 +374,7 @@ brin_revmap_data(PG_FUNCTION_ARGS)
374374
if (!superuser())
375375
ereport(ERROR,
376376
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
377-
(errmsg("must be superuser to use raw page functions"))));
377+
errmsg("must be superuser to use raw page functions")));
378378

379379
if (SRF_IS_FIRSTCALL())
380380
{

contrib/pageinspect/btreefuncs.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ bt_page_stats(PG_FUNCTION_ARGS)
174174
if (!superuser())
175175
ereport(ERROR,
176176
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
177-
(errmsg("must be superuser to use pageinspect functions"))));
177+
errmsg("must be superuser to use pageinspect functions")));
178178

179179
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
180180
rel = relation_openrv(relrv, AccessShareLock);
@@ -318,7 +318,7 @@ bt_page_items(PG_FUNCTION_ARGS)
318318
if (!superuser())
319319
ereport(ERROR,
320320
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
321-
(errmsg("must be superuser to use pageinspect functions"))));
321+
errmsg("must be superuser to use pageinspect functions")));
322322

323323
if (SRF_IS_FIRSTCALL())
324324
{
@@ -428,7 +428,7 @@ bt_page_items_bytea(PG_FUNCTION_ARGS)
428428
if (!superuser())
429429
ereport(ERROR,
430430
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
431-
(errmsg("must be superuser to use raw page functions"))));
431+
errmsg("must be superuser to use raw page functions")));
432432

433433
if (SRF_IS_FIRSTCALL())
434434
{
@@ -518,7 +518,7 @@ bt_metap(PG_FUNCTION_ARGS)
518518
if (!superuser())
519519
ereport(ERROR,
520520
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
521-
(errmsg("must be superuser to use pageinspect functions"))));
521+
errmsg("must be superuser to use pageinspect functions")));
522522

523523
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
524524
rel = relation_openrv(relrv, AccessShareLock);

contrib/pageinspect/fsmfuncs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fsm_page_contents(PG_FUNCTION_ARGS)
4242
if (!superuser())
4343
ereport(ERROR,
4444
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
45-
(errmsg("must be superuser to use raw page functions"))));
45+
errmsg("must be superuser to use raw page functions")));
4646

4747
fsmpage = (FSMPage) PageGetContents(VARDATA(raw_page));
4848

contrib/pageinspect/ginfuncs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ gin_metapage_info(PG_FUNCTION_ARGS)
4545
if (!superuser())
4646
ereport(ERROR,
4747
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
48-
(errmsg("must be superuser to use raw page functions"))));
48+
errmsg("must be superuser to use raw page functions")));
4949

5050
page = get_page_from_raw(raw_page);
5151

@@ -103,7 +103,7 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
103103
if (!superuser())
104104
ereport(ERROR,
105105
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
106-
(errmsg("must be superuser to use raw page functions"))));
106+
errmsg("must be superuser to use raw page functions")));
107107

108108
page = get_page_from_raw(raw_page);
109109

@@ -169,7 +169,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
169169
if (!superuser())
170170
ereport(ERROR,
171171
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
172-
(errmsg("must be superuser to use raw page functions"))));
172+
errmsg("must be superuser to use raw page functions")));
173173

174174
if (SRF_IS_FIRSTCALL())
175175
{

contrib/pageinspect/hashfuncs.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ hash_page_type(PG_FUNCTION_ARGS)
195195
if (!superuser())
196196
ereport(ERROR,
197197
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
198-
(errmsg("must be superuser to use raw page functions"))));
198+
errmsg("must be superuser to use raw page functions")));
199199

200200
page = verify_hash_page(raw_page, 0);
201201

@@ -243,7 +243,7 @@ hash_page_stats(PG_FUNCTION_ARGS)
243243
if (!superuser())
244244
ereport(ERROR,
245245
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
246-
(errmsg("must be superuser to use raw page functions"))));
246+
errmsg("must be superuser to use raw page functions")));
247247

248248
page = verify_hash_page(raw_page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
249249

@@ -310,7 +310,7 @@ hash_page_items(PG_FUNCTION_ARGS)
310310
if (!superuser())
311311
ereport(ERROR,
312312
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
313-
(errmsg("must be superuser to use raw page functions"))));
313+
errmsg("must be superuser to use raw page functions")));
314314

315315
if (SRF_IS_FIRSTCALL())
316316
{
@@ -415,7 +415,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
415415
if (!superuser())
416416
ereport(ERROR,
417417
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
418-
(errmsg("must be superuser to use raw page functions"))));
418+
errmsg("must be superuser to use raw page functions")));
419419

420420
indexRel = index_open(indexRelid, AccessShareLock);
421421

@@ -526,7 +526,7 @@ hash_metapage_info(PG_FUNCTION_ARGS)
526526
if (!superuser())
527527
ereport(ERROR,
528528
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
529-
(errmsg("must be superuser to use raw page functions"))));
529+
errmsg("must be superuser to use raw page functions")));
530530

531531
page = verify_hash_page(raw_page, LH_META_PAGE);
532532

contrib/pageinspect/heapfuncs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ heap_page_items(PG_FUNCTION_ARGS)
135135
if (!superuser())
136136
ereport(ERROR,
137137
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
138-
(errmsg("must be superuser to use raw page functions"))));
138+
errmsg("must be superuser to use raw page functions")));
139139

140140
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
141141

contrib/pageinspect/rawpage.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ get_raw_page_internal(text *relname, ForkNumber forknum, BlockNumber blkno)
102102
if (!superuser())
103103
ereport(ERROR,
104104
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
105-
(errmsg("must be superuser to use raw page functions"))));
105+
errmsg("must be superuser to use raw page functions")));
106106

107107
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
108108
rel = relation_openrv(relrv, AccessShareLock);
@@ -233,7 +233,7 @@ page_header(PG_FUNCTION_ARGS)
233233
if (!superuser())
234234
ereport(ERROR,
235235
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
236-
(errmsg("must be superuser to use raw page functions"))));
236+
errmsg("must be superuser to use raw page functions")));
237237

238238
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
239239

@@ -305,7 +305,7 @@ page_checksum(PG_FUNCTION_ARGS)
305305
if (!superuser())
306306
ereport(ERROR,
307307
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
308-
(errmsg("must be superuser to use raw page functions"))));
308+
errmsg("must be superuser to use raw page functions")));
309309

310310
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
311311

contrib/pg_prewarm/pg_prewarm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
7777
if (PG_ARGISNULL(1))
7878
ereport(ERROR,
7979
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
80-
(errmsg("prewarm type cannot be null"))));
80+
errmsg("prewarm type cannot be null")));
8181
type = PG_GETARG_TEXT_PP(1);
8282
ttype = text_to_cstring(type);
8383
if (strcmp(ttype, "prefetch") == 0)
@@ -97,7 +97,7 @@ pg_prewarm(PG_FUNCTION_ARGS)
9797
if (PG_ARGISNULL(2))
9898
ereport(ERROR,
9999
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
100-
(errmsg("relation fork cannot be null"))));
100+
errmsg("relation fork cannot be null")));
101101
forkName = PG_GETARG_TEXT_PP(2);
102102
forkString = text_to_cstring(forkName);
103103
forkNumber = forkname_to_number(forkString);

contrib/pgstattuple/pgstatapprox.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pgstattuple_approx(PG_FUNCTION_ARGS)
228228
if (!superuser())
229229
ereport(ERROR,
230230
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
231-
(errmsg("must be superuser to use pgstattuple functions"))));
231+
errmsg("must be superuser to use pgstattuple functions")));
232232

233233
PG_RETURN_DATUM(pgstattuple_approx_internal(relid, fcinfo));
234234
}

contrib/pgstattuple/pgstatindex.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pgstatindex(PG_FUNCTION_ARGS)
151151
if (!superuser())
152152
ereport(ERROR,
153153
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
154-
(errmsg("must be superuser to use pgstattuple functions"))));
154+
errmsg("must be superuser to use pgstattuple functions")));
155155

156156
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
157157
rel = relation_openrv(relrv, AccessShareLock);
@@ -193,7 +193,7 @@ pgstatindexbyid(PG_FUNCTION_ARGS)
193193
if (!superuser())
194194
ereport(ERROR,
195195
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
196-
(errmsg("must be superuser to use pgstattuple functions"))));
196+
errmsg("must be superuser to use pgstattuple functions")));
197197

198198
rel = relation_open(relid, AccessShareLock);
199199

@@ -386,7 +386,7 @@ pg_relpages(PG_FUNCTION_ARGS)
386386
if (!superuser())
387387
ereport(ERROR,
388388
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
389-
(errmsg("must be superuser to use pgstattuple functions"))));
389+
errmsg("must be superuser to use pgstattuple functions")));
390390

391391
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
392392
rel = relation_openrv(relrv, AccessShareLock);
@@ -438,7 +438,7 @@ pg_relpagesbyid(PG_FUNCTION_ARGS)
438438
if (!superuser())
439439
ereport(ERROR,
440440
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
441-
(errmsg("must be superuser to use pgstattuple functions"))));
441+
errmsg("must be superuser to use pgstattuple functions")));
442442

443443
rel = relation_open(relid, AccessShareLock);
444444

@@ -492,7 +492,7 @@ pgstatginindex(PG_FUNCTION_ARGS)
492492
if (!superuser())
493493
ereport(ERROR,
494494
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
495-
(errmsg("must be superuser to use pgstattuple functions"))));
495+
errmsg("must be superuser to use pgstattuple functions")));
496496

497497
PG_RETURN_DATUM(pgstatginindex_internal(relid, fcinfo));
498498
}

contrib/pgstattuple/pgstattuple.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pgstattuple(PG_FUNCTION_ARGS)
173173
if (!superuser())
174174
ereport(ERROR,
175175
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
176-
(errmsg("must be superuser to use pgstattuple functions"))));
176+
errmsg("must be superuser to use pgstattuple functions")));
177177

178178
/* open relation */
179179
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
@@ -213,7 +213,7 @@ pgstattuplebyid(PG_FUNCTION_ARGS)
213213
if (!superuser())
214214
ereport(ERROR,
215215
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
216-
(errmsg("must be superuser to use pgstattuple functions"))));
216+
errmsg("must be superuser to use pgstattuple functions")));
217217

218218
/* open relation */
219219
rel = relation_open(relid, AccessShareLock);

0 commit comments

Comments
 (0)