purescript-selda icon indicating copy to clipboard operation
purescript-selda copied to clipboard

Different Expr type for different backends - Count & Max return type

Open Kamirus opened this issue 4 years ago • 1 comments

pg returns the result of the COUT/MAX as String, because of potential precision loss. While other backends can return Int there (and losing some digits if the result does not fit the Int range)

It is useful to have the expression of type Col s Int rather than Col s String e.g. comparison on strings is different than on ints.

Potential solution:

  • drop the appropriate type in the Expr AST
  • add CAST expression (extend Expr)
  • implement count, max_ and other related functions per backend

Kamirus avatar Dec 17 '19 19:12 Kamirus

I think we should handle this using purescript-bigints if possible in case of postgresql and not String.

paluh avatar Dec 17 '19 19:12 paluh