sqlboiler icon indicating copy to clipboard operation
sqlboiler copied to clipboard

Support NaN insertion

Open tzachshabtay opened this issue 5 years ago • 1 comments

Looking at the current decimal implementation it doesn't support NaN insertion: https://github.com/volatiletech/sqlboiler/blob/fad098aa2ba38220c0727620b7ea665983aec26e/types/decimal.go#L29

And trying to insert it anyway results in an error: refusing to allow NaN into database

However postgres does support NaN: https://www.postgresqltutorial.com/postgresql-numeric/

Can we change decimal to support NaN insertion?

tzachshabtay avatar Jul 13 '20 20:07 tzachshabtay

I'm opened to hearing proposals that would create an opt-in method of skipping this check. An alternative solution is to just fork this implementation and remove the check and host it elsewhere (using a type replacement to use the forked version). The reason this was chosen as the default is that a great many users of this implementation will be dealing with the finance world where it would be an egregious error to allow a NaN into the DB.

aarondl avatar Jul 19 '20 23:07 aarondl