Open AnyhowStep opened 4 years ago
We are abusing an aggregate function, derived table, and compound query just to get integer overflow errors...
I don't know what madness inspired me to come up with this workaround. I regret it now because I'm seriously considering this...
user-defined functions are more "elegant" but it means having to always create it, and the AST isn't technically portable unless the special bigint_add()
function is added to every SQLite database you want to run the query on
We want a throw-on-overflow addition operator, and not a cast-on-overflow operator, because of this,
SELECT
(9223372036854775807+9223372036854775807)/9973
This should throw.
But on SQLite, we get 1849668512354311.8
It is decidedly not an integer.
According to the SQLite documentation, https://www.sqlite.org/lang_aggfunc.html