-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return value out of range #15
Comments
Hi Martin,
I'm assuming this generated an error for you on compile? Which os/compiler
did you use? On our various compiles this does not show up.
As for the issue, in PostgreSQL the *ereport *function causes an exit, so
execution will never reach the return that follows. Some compilers complain
if there isn't a final return in a function, so that is why there is one.
Although, it will never reach it.
I will correct it with a patch, though, so that it won't cause any other
issues.
John
…On Wed, Jan 27, 2021 at 1:17 AM Martin Strunz ***@***.***> wrote:
/src/backend/utils/adt/agtype_util.c line 1536 Non-boolean value returned
from function returning bool
static bool equals_agtype_scalar_value(agtype_value *a, agtype_value *b)
{
if (a->type == b->type)
{
switch (a->type)
{
case AGTV_NULL:
return true;
case AGTV_STRING:
return length_compare_agtype_string_value(a, b) == 0;
case AGTV_NUMERIC:
return DatumGetBool(DirectFunctionCall2(
numeric_eq, PointerGetDatum(a->val.numeric),
PointerGetDatum(b->val.numeric)));
case AGTV_BOOL:
return a->val.boolean == b->val.boolean;
case AGTV_INTEGER:
return a->val.int_value == b->val.int_value;
case AGTV_FLOAT:
return a->val.float_value == b->val.float_value;
case AGTV_VERTEX:
{
graphid a_graphid, b_graphid;
a_graphid = a->val.object.pairs[0].value.val.int_value;
b_graphid = b->val.object.pairs[0].value.val.int_value;
return a_graphid == b_graphid;
}
default:
ereport(ERROR, (errmsg("invalid agtype scalar type %d for equals",
a->type)));
}
}
ereport(ERROR, (errmsg("agtype input scalars must be of same type")));
return -1; // <- should be bool
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#15>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALPO4EERTXHP5TUFZQGYS3S37KZ5ANCNFSM4WU47RPA>
.
|
jrgemignani
added a commit
that referenced
this issue
Jan 27, 2021
[apache/incubator-age] return value out of range (#15) /src/backend/utils/adt/agtype_util.c line 1536 Non-boolean value returned from function returning bool Added comments and changed type of value returned to match function prototype. Technically, though, execution will never reach this point. This is merely to make the compiler happy.
Patch applied |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/src/backend/utils/adt/agtype_util.c line 1536 Non-boolean value returned from function returning bool
static bool equals_agtype_scalar_value(agtype_value *a, agtype_value *b)
{
if (a->type == b->type)
{
switch (a->type)
{
case AGTV_NULL:
return true;
case AGTV_STRING:
return length_compare_agtype_string_value(a, b) == 0;
case AGTV_NUMERIC:
return DatumGetBool(DirectFunctionCall2(
numeric_eq, PointerGetDatum(a->val.numeric),
PointerGetDatum(b->val.numeric)));
case AGTV_BOOL:
return a->val.boolean == b->val.boolean;
case AGTV_INTEGER:
return a->val.int_value == b->val.int_value;
case AGTV_FLOAT:
return a->val.float_value == b->val.float_value;
case AGTV_VERTEX:
{
graphid a_graphid, b_graphid;
a_graphid = a->val.object.pairs[0].value.val.int_value;
b_graphid = b->val.object.pairs[0].value.val.int_value;
}
The text was updated successfully, but these errors were encountered: