You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a query returns a nested structure from a JSON(b) field, the empty field must be absent for the query to work. If the field is present and null, there is a circe exception thrown.
Example query:
sql"SELECT address->'coordinates' FROM profile"
Definition of the Coordinates and Address types:
case class Coordinates(latitude: Double, longitude: Double)
case class Address(coordinates: Option[Coordinates])
Definition of the custom mapping:
given Meta[Coordinates] = new Meta(pgDecoderGet, pgEncoderPut)
given Meta[Address] = new Meta(pgDecoderGet, pgEncoderPut)
The query works for the following contents of the address column: NULL {}
The query throws and exception for the following contents of the address column: {"coordinates":null}
The exception message is: io.circe.DecodingFailure$DecodingFailureImpl: DecodingFailure at : Got value 'null' with wrong type, expecting object