Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up`avg` cannot be used on SQLite #1409
Comments
killercup
added
discussion desired
sqlite
labels
Jan 3, 2018
sgrif
added this to the 1.2 milestone
Jan 15, 2018
added a commit
that referenced
this issue
Apr 5, 2018
added a commit
that referenced
this issue
Apr 5, 2018
added a commit
that referenced
this issue
Apr 6, 2018
sgrif
closed this
in
#1617
Apr 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sgrif commentedDec 16, 2017
The return type of
avgfor all integer types isNumeric, which is the arbitrary precision floating point type. SQLite has no concept of this type. We can't really have the return type ofavgbe dependent on the backend (since we don't know the backend at the pointavgis called). So we probably need to add some "support" forNumericon SQLite. We should never infer this fromdiesel print-schemaor anything like that, but we do need to doimpl HasSqlType<Numeric> for Sqlite, and provide aFromSqlimpl for something there.The question is whether we should have
Numericpretend to beText, and provide aFromSqlimpl forBigDecimal, or whether we should have it pretend to beDoubleand provide an impl forf64. I'm guessing it should be the latter, since the floating point precision issues will happen on the DB side, but I'd like to see a query that demonstrates thatavg(int_column)will in fact be limited by 64 bit float precision on SQLite regardless of what we do on our end.