jrgemignani commented on code in PR #895:
URL: https://github.com/apache/age/pull/895#discussion_r1190236596
##########
src/backend/utils/adt/agtype.c:
##########
@@ -2788,6 +2789,9 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
else if (agtv.type == AGTV_NUMERIC)
result = DatumGetFloat8(DirectFunctionCall1(numeric_float8,
NumericGetDatum(agtv.val.numeric)));
+ else if (agtv.type == AGTV_STRING)
Review Comment:
All if/else blocks need to have {} for all code, even if it is only one line.
##########
src/backend/utils/adt/agtype.c:
##########
@@ -2788,6 +2789,9 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
else if (agtv.type == AGTV_NUMERIC)
Review Comment:
When we work on functions that don't conform to our standards, we
proactively try to clean them up. Just the functions that we are working on. If
you could adjust the function to have {} where necessary.
##########
src/backend/utils/adt/agtype.c:
##########
@@ -2759,7 +2759,8 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
if (!agtype_extract_scalar(&agtype_in->root, &agtv) ||
(agtv.type != AGTV_FLOAT &&
agtv.type != AGTV_INTEGER &&
- agtv.type != AGTV_NUMERIC))
+ agtv.type != AGTV_NUMERIC &&
+ agtv.type != AGTV_STRING))
Review Comment:
When we work on functions that don't conform to our standards, we
proactively try to clean them up. Just the functions that we are working on. If
you could adjust the function to have {} where necessary.
##########
src/backend/utils/adt/agtype.c:
##########
@@ -2788,6 +2789,9 @@ Datum agtype_to_float8(PG_FUNCTION_ARGS)
else if (agtv.type == AGTV_NUMERIC)
result = DatumGetFloat8(DirectFunctionCall1(numeric_float8,
NumericGetDatum(agtv.val.numeric)));
+ else if (agtv.type == AGTV_STRING)
+ result = DatumGetFloat8(DirectFunctionCall1(float8in,
+
CStringGetDatum(agtv.val.string.val)));
else
Review Comment:
When we work on functions that don't conform to our standards, we
proactively try to clean them up. Just the functions that we are working on. If
you could adjust the function to have {} where necessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]