Skip to content
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

Closed
maddin200 opened this issue Jan 27, 2021 · 2 comments
Closed

return value out of range #15

maddin200 opened this issue Jan 27, 2021 · 2 comments
Assignees

Comments

@maddin200
Copy link

/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

}

@jrgemignani
Copy link
Contributor

jrgemignani commented Jan 27, 2021 via email

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.
@jrgemignani
Copy link
Contributor

Patch applied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants