Skip to content

Commit 4ac0f45

Browse files
committed
Message style improvements
1 parent 3d7c752 commit 4ac0f45

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

src/backend/commands/typecmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ DefineType(ParseState *pstate, List *names, List *parameters)
495495
analyzeOid = findTypeAnalyzeFunction(analyzeName, typoid);
496496

497497
/*
498-
* Likewise look up the subscripting procedure if any. If it is not
498+
* Likewise look up the subscripting function if any. If it is not
499499
* specified, but a typelem is specified, allow that if
500500
* raw_array_subscript_handler can be used. (This is for backwards
501501
* compatibility; maybe someday we should throw an error instead.)
@@ -509,7 +509,7 @@ DefineType(ParseState *pstate, List *names, List *parameters)
509509
else
510510
ereport(ERROR,
511511
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
512-
errmsg("element type cannot be specified without a valid subscripting procedure")));
512+
errmsg("element type cannot be specified without a subscripting function")));
513513
}
514514

515515
/*
@@ -837,7 +837,7 @@ DefineDomain(CreateDomainStmt *stmt)
837837
analyzeProcedure = baseType->typanalyze;
838838

839839
/*
840-
* Domains don't need a subscript procedure, since they are not
840+
* Domains don't need a subscript function, since they are not
841841
* subscriptable on their own. If the base type is subscriptable, the
842842
* parser will reduce the type to the base type before subscripting.
843843
*/

src/backend/libpq/auth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ set_authn_id(Port *port, const char *id)
357357
* connection continue, either.
358358
*/
359359
ereport(FATAL,
360-
(errmsg("connection was re-authenticated"),
361-
errdetail_log("previous ID: \"%s\"; new ID: \"%s\"",
360+
(errmsg("authentication identifier set more than once"),
361+
errdetail_log("previous identifier: \"%s\"; new identifier: \"%s\"",
362362
port->authn_id, id)));
363363
}
364364

src/backend/libpq/be-secure-openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ X509_NAME_to_cstring(X509_NAME *name)
13921392
if (membuf == NULL)
13931393
ereport(ERROR,
13941394
(errcode(ERRCODE_OUT_OF_MEMORY),
1395-
errmsg("failed to create BIO")));
1395+
errmsg("could not create BIO")));
13961396

13971397
(void) BIO_set_close(membuf, BIO_CLOSE);
13981398
for (i = 0; i < count; i++)

src/backend/utils/adt/jsonbsubs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ jsonb_subscript_transform(SubscriptingRef *sbsref,
100100
if (targetType != UNKNOWNOID)
101101
ereport(ERROR,
102102
(errcode(ERRCODE_DATATYPE_MISMATCH),
103-
errmsg("subscript type is not supported"),
104-
errhint("Jsonb subscript must be coerced "
105-
"only to one type, integer or text."),
103+
errmsg("subscript type %s is not supported", format_type_be(subExprType)),
104+
errhint("jsonb subscript must be coercible to only one type, integer or text."),
106105
parser_errposition(pstate, exprLocation(subExpr))));
107106

108107
targetType = targets[i];
@@ -115,8 +114,8 @@ jsonb_subscript_transform(SubscriptingRef *sbsref,
115114
if (targetType == UNKNOWNOID)
116115
ereport(ERROR,
117116
(errcode(ERRCODE_DATATYPE_MISMATCH),
118-
errmsg("subscript type is not supported"),
119-
errhint("Jsonb subscript must be coerced to either integer or text"),
117+
errmsg("subscript type %s is not supported", format_type_be(subExprType)),
118+
errhint("jsonb subscript must be coercible to either integer or text."),
120119
parser_errposition(pstate, exprLocation(subExpr))));
121120
}
122121
else

src/backend/utils/adt/multirangetypes.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ multirange_constructor2(PG_FUNCTION_ARGS)
961961

962962
if (PG_ARGISNULL(0))
963963
elog(ERROR,
964-
"multirange values cannot contain NULL members");
964+
"multirange values cannot contain null members");
965965

966966
rangeArray = PG_GETARG_ARRAYTYPE_P(0);
967967

@@ -973,9 +973,7 @@ multirange_constructor2(PG_FUNCTION_ARGS)
973973

974974
rngtypid = ARR_ELEMTYPE(rangeArray);
975975
if (rngtypid != rangetyp->type_id)
976-
ereport(ERROR,
977-
(errcode(ERRCODE_DATATYPE_MISMATCH),
978-
errmsg("type %u does not match constructor type", rngtypid)));
976+
elog(ERROR, "type %u does not match constructor type", rngtypid);
979977

980978
/*
981979
* Be careful: we can still be called with zero ranges, like this:
@@ -997,7 +995,7 @@ multirange_constructor2(PG_FUNCTION_ARGS)
997995
if (nulls[i])
998996
ereport(ERROR,
999997
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
1000-
errmsg("multirange values cannot contain NULL members")));
998+
errmsg("multirange values cannot contain null members")));
1001999

10021000
/* make_multirange will do its own copy */
10031001
ranges[i] = DatumGetRangeTypeP(elements[i]);
@@ -1031,16 +1029,14 @@ multirange_constructor1(PG_FUNCTION_ARGS)
10311029

10321030
if (PG_ARGISNULL(0))
10331031
elog(ERROR,
1034-
"multirange values cannot contain NULL members");
1032+
"multirange values cannot contain null members");
10351033

10361034
range = PG_GETARG_RANGE_P(0);
10371035

10381036
/* Make sure the range type matches. */
10391037
rngtypid = RangeTypeGetOid(range);
10401038
if (rngtypid != rangetyp->type_id)
1041-
ereport(ERROR,
1042-
(errcode(ERRCODE_DATATYPE_MISMATCH),
1043-
errmsg("type %u does not match constructor type", rngtypid)));
1039+
elog(ERROR, "type %u does not match constructor type", rngtypid);
10441040

10451041
PG_RETURN_MULTIRANGE_P(make_multirange(mltrngtypid, rangetyp, 1, &range));
10461042
}

src/test/regress/expected/jsonb.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4822,10 +4822,10 @@ select ('[1, "2", null]'::jsonb)['1'];
48224822
(1 row)
48234823

48244824
select ('[1, "2", null]'::jsonb)[1.0];
4825-
ERROR: subscript type is not supported
4825+
ERROR: subscript type numeric is not supported
48264826
LINE 1: select ('[1, "2", null]'::jsonb)[1.0];
48274827
^
4828-
HINT: Jsonb subscript must be coerced to either integer or text
4828+
HINT: jsonb subscript must be coercible to either integer or text.
48294829
select ('[1, "2", null]'::jsonb)[2];
48304830
jsonb
48314831
-------

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy