-
-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Description
Apparently, Postgres encodes NULL values inside arrays in a way that PostgreSQLDataDecoder does not anticipate. In this case, the byte count of the value is -1, which causes this line called from here to explode with a friendly error:
Fatal error: Can't form Range with upperBound < lowerBound
While this originally was discovered by using the array_agg function combined with left joins (which triggers this weird behavior), there is a much simpler reproduction:
conn.raw("SELECT ARRAY[NULL, 'foo', NULL, 'bar'] AS arr")
.all(decoding: SimpleArray.self)where SimpleArray is defined as:
struct SimpleArray: Decodable {
let arr: [String?]
}The issue was discovered with Vapor 3 / Postgres (driver) 1.4.1.
V4 doesn't seem to be affected as array decoding is not implemented at all at the time of writing.
Metadata
Metadata
Assignees
Labels
No labels