Open
Description
Describe the issue
Incorrect column type when encoding an empty Set
Vapor version
4.95
Operating system and version
macOS 14.4
Swift version
Swift Package Manager - Swift 5.10.0-dev
Steps to reproduce
I'm using a Fluent model with a field defined as:
@Field(key: "things")
var things: Set<Thing>
where Thing
is an Int enum.
Attempt to create/insert a model where things = []
.
Outcome
I get the following error:
[ WARNING ] PSQLError(code: server, serverInfo: [sqlState: 42804, file: parse_target.c, hint: You will need to rewrite or cast the expression., line: 595, message: column "things" is of type integer[] but expression is of type jsonb[], position: 256, routine: transformAssignedExpr, localizedSeverity: ERROR, severity: ERROR], triggeredFromRequestInFile: PostgresKit/PostgresDatabase+SQL.swift, line: 71
Additional notes
It works when set to a non-empty Set.