zio / zio-sql

Type-safe, composable SQL for ZIO applications
https://zio.dev/zio-sql/
Apache License 2.0
236 stars 116 forks source link

decide on handling of unsupported data types in JDBC (ZonedDateTime, Instant and OffsetTime), UUID in MySQL #322

Open robmwalsh opened 3 years ago

robmwalsh commented 3 years ago

According to https://jdbc.postgresql.org/documentation/head/java8-date-time.html, ZonedDateTime, Instant and OffsetTime are not supported by JDBC. Some databases will likely support these types if we bypass the JDBC driver (everything else is platform specific, why not executor as well :D) . A couple of options:

  1. have some reasonable defaults e.g. Use an instant stored as an integer type or timestamp at UTC, zoned date time might use a timestamp which is always UTC
  2. remove these types from the default type tags and implement them separately as platform specific extensions
  3. allow users to define how they'd like them stored using a typeclass or something?
  4. do something crazy like having two columns (with one to store tz information) accessed as if it's one by zio-sql (I don't think this is a good idea...)

1 and 2 would require good documentation and consistent handling across the types. 3 & 4 are probably unideal...

@jczuchnowski / @jdegoes any thoughts on this?

robmwalsh commented 3 years ago

In #321 @andrewhj pointed out MySQL doesn't support UUID directly, so that's another one we'll have to tackle.

https://github.com/zio/zio-sql/pull/321#issuecomment-733524550

jczuchnowski commented 2 years ago

Need more research if the way we're handling it now is correct. Specific tests would be good.