-
Notifications
You must be signed in to change notification settings - Fork 2.3k
-
Example SQL:
select sum(1 + 2) as col
Called this function to get precision and scale:
precision, scale, ok := columnType.DecimalSize()
The returned precision is 42. I don't understand where did 42 come from. It's supposed to be 1, right?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
It returns precision and scale of column type, not a value in specific row.
In this case, it represents max digits in the DECIMAL type that SUM returns. (I don't know what database and version you are using.)
See also: https://pkg.go.dev/database/sql/driver#RowsColumnTypePrecisionScale
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment