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

refacting toStringList() function for int64 types #1128

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/backend/utils/adt/agtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -6210,7 +6210,6 @@ Datum age_tostringlist(PG_FUNCTION_ARGS)
agtype_value string_elem;
int count;
int i;
float float_num;
char buffer[64];

/* check for null */
Expand Down Expand Up @@ -6263,8 +6262,7 @@ Datum age_tostringlist(PG_FUNCTION_ARGS)
break;

case AGTV_FLOAT:

float_num = elem->val.float_value;

sprintf(buffer, "%.*g", DBL_DIG, elem->val.float_value);
string_elem.val.string.val = pstrdup(buffer);
string_elem.val.string.len = strlen(buffer);
Expand All @@ -6275,7 +6273,7 @@ Datum age_tostringlist(PG_FUNCTION_ARGS)

case AGTV_INTEGER:

sprintf(buffer, "%d", elem->val.int_value);
sprintf(buffer, "%ld", elem->val.int_value);
string_elem.val.string.val = pstrdup(buffer);
string_elem.val.string.len = strlen(buffer);

Expand Down