mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Improve error reporting in opclasscmds.c
This commit improves error reporting introduced by 911e702077. It puts argument of errmsg() to the single line for easier grepping source for error text. Also it improves wording of errhint().
This commit is contained in:
parent
087d3d0583
commit
02a5786df2
@ -1156,16 +1156,14 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid,
|
|||||||
(OidIsValid(member->righttype) && member->righttype != typeoid))
|
(OidIsValid(member->righttype) && member->righttype != typeoid))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||||
errmsg("associated data types for opclass options "
|
errmsg("associated data types for opclass options parsing functions must match opclass input type")));
|
||||||
"parsing functions must match opclass input type")));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (member->lefttype != member->righttype)
|
if (member->lefttype != member->righttype)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||||
errmsg("left and right associated data types for "
|
errmsg("left and right associated data types for opclass options parsing functions must match")));
|
||||||
"opclass options parsing functions must match")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (procform->prorettype != VOIDOID ||
|
if (procform->prorettype != VOIDOID ||
|
||||||
@ -1174,9 +1172,10 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid,
|
|||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||||
errmsg("invalid opclass options parsing function"),
|
errmsg("invalid opclass options parsing function"),
|
||||||
errhint("opclass options parsing function must have signature '%s'",
|
errhint("Valid signature of opclass options parsing function is '%s'.",
|
||||||
"(internal) RETURNS void")));
|
"(internal) RETURNS void")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* btree comparison procs must be 2-arg procs returning int4. btree
|
* btree comparison procs must be 2-arg procs returning int4. btree
|
||||||
* sortsupport procs must take internal and return void. btree in_range
|
* sortsupport procs must take internal and return void. btree in_range
|
||||||
|
@ -506,7 +506,7 @@ ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 test_opclass_options_
|
|||||||
ERROR: function test_opclass_options_func(internal, text[], boolean) does not exist
|
ERROR: function test_opclass_options_func(internal, text[], boolean) does not exist
|
||||||
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) btint42cmp(int4, int2);
|
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) btint42cmp(int4, int2);
|
||||||
ERROR: invalid opclass options parsing function
|
ERROR: invalid opclass options parsing function
|
||||||
HINT: opclass options parsing function must have signature '(internal) RETURNS void'
|
HINT: Valid signature of opclass options parsing function is '(internal) RETURNS void'.
|
||||||
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4, int2) btint42cmp(int4, int2);
|
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4, int2) btint42cmp(int4, int2);
|
||||||
ERROR: left and right associated data types for opclass options parsing functions must match
|
ERROR: left and right associated data types for opclass options parsing functions must match
|
||||||
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) test_opclass_options_func(internal); -- Ok
|
ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) test_opclass_options_func(internal); -- Ok
|
||||||
|
Loading…
x
Reference in New Issue
Block a user