Skip to content

Missing Vec<T>? #1169

@sadraskol

Description

@sadraskol

We encountered a problem with the inference of types with sqlx. We defined a custom enum for an array column and sqlx does not seem to like that.

There is a small demo of this here.

The compiler says the trait Type<_> is not implemented for Vec although Vec<T: Type> is documented as a correct array type in the documentation

Versions affected

We are using sqlx 0.4 to be compatible with current stable actix_web runtime. It does not work with sqlx 0.5 neither.

Workaround

We have found a workaround: use Json<Vec<Occupation>> as a type and change the request accordingly: select name, to_jsonb(occupation) from speaker.

Discussion

It seems that Vec<T> has no implementation of trait Type when T is also Type.

If we were to add this implementation, would it solve the issue or is there something we haven't thought of? We are ready to contribute if our intuition is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions