-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null in array serialized wrongly #488
Comments
Here's a working workaround which I assume works on the fact that String is a primitive implicit private val listOptionStrType: DriverJdbcType[List[Option[String]]] =
new SimpleArrayJdbcType[String]("text")
.to[List](
_.map(Option(_)).toList.asInstanceOf[List[String]],
_.asInstanceOf[List[Option[String]]].map(_.orNull)
)
.asInstanceOf[DriverJdbcType[List[Option[String]]]] |
@Katrix well, I missed to test |
tminglei
added a commit
that referenced
this issue
Aug 8, 2020
@Katrix fixed, pls help double check. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using code like this
Trying to insert a None in the list produces an empty string for that element, and not the NULL identifier. For example, trying to insert
List(Some("[2.3,)"), Some("[0.3.0,)"), None, Some("7.1.0"), None)
produces the error
org.postgresql.util.PSQLException: ERROR: malformed array literal: "{"[2.3,)","[0.3.0,)",,7.1.0,}"
.From the Postgres docs, NULL values should be written as null, and not as an empty string
The text was updated successfully, but these errors were encountered: