Skip to content

Commit 02a5786

Browse files
committed
Improve error reporting in opclasscmds.c
This commit improves error reporting introduced by 911e702. It puts argument of errmsg() to the single line for easier grepping source for error text. Also it improves wording of errhint().
1 parent 087d3d0 commit 02a5786

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/backend/commands/opclasscmds.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -1156,16 +1156,14 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid,
11561156
(OidIsValid(member->righttype) && member->righttype != typeoid))
11571157
ereport(ERROR,
11581158
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1159-
errmsg("associated data types for opclass options "
1160-
"parsing functions must match opclass input type")));
1159+
errmsg("associated data types for opclass options parsing functions must match opclass input type")));
11611160
}
11621161
else
11631162
{
11641163
if (member->lefttype != member->righttype)
11651164
ereport(ERROR,
11661165
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1167-
errmsg("left and right associated data types for "
1168-
"opclass options parsing functions must match")));
1166+
errmsg("left and right associated data types for opclass options parsing functions must match")));
11691167
}
11701168

11711169
if (procform->prorettype != VOIDOID ||
@@ -1174,9 +1172,10 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid,
11741172
ereport(ERROR,
11751173
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
11761174
errmsg("invalid opclass options parsing function"),
1177-
errhint("opclass options parsing function must have signature '%s'",
1175+
errhint("Valid signature of opclass options parsing function is '%s'.",
11781176
"(internal) RETURNS void")));
11791177
}
1178+
11801179
/*
11811180
* btree comparison procs must be 2-arg procs returning int4. btree
11821181
* sortsupport procs must take internal and return void. btree in_range

src/test/regress/expected/alter_generic.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 test_opclass_options_
506506
ERROR: function test_opclass_options_func(internal, text[], boolean) does not exist
507507
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) btint42cmp(int4, int2);
508508
ERROR: invalid opclass options parsing function
509-
HINT: opclass options parsing function must have signature '(internal) RETURNS void'
509+
HINT: Valid signature of opclass options parsing function is '(internal) RETURNS void'.
510510
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4, int2) btint42cmp(int4, int2);
511511
ERROR: left and right associated data types for opclass options parsing functions must match
512512
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) test_opclass_options_func(internal); -- Ok

0 commit comments

Comments
 (0)