@LostKobrakai oops, this was a problem when adapting my “real” schema, the second couple of “cast” clauses were actually “dump”.
Although I did find my issue when trying to make a simple reproduction: the problem was not when inserting the struct, it was when querying without the struct - something along the lines of Repo.get_by(MySchema, composite_field: {"one", "two"}). This indeed does not work, however, it can be worked around by explicitly casting to the type:
from(schema in MySchema,
where: schema.composite_field == type(^{"one", "two"}, MyType)
)
|> Repo.one()
This works perfectly fine ![]()
Thank you for your time, sorry for the bother, I may have been quite tired yesterday ![]()






















