Closed
Description
Having a table that looks like this
CREATE TABLE IF NOT EXISTS "public"."items" (
"id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
"user_id" "uuid" NOT NULL,
"name" "uuid"
);
It should be possible to write
let toInsert = items.map { item in
InsertDTO(
user_id: userId,
name: item.name, // Can be nil
)
}
try await supabaseClient.database.from("items")
.insert(toInsert)
.execute()
However this is not possible since I get the error invalid input syntax for type uuid: "NULL"
.
My solution has been to insert twice; once for the items with name
present and once for the items with name
as nil
. But this does not seem optimal.