Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Vec<T>? #1169

Closed
sadraskol opened this issue Apr 12, 2021 · 2 comments
Closed

Missing Vec<T>? #1169

sadraskol opened this issue Apr 12, 2021 · 2 comments

Comments

@sadraskol
Copy link

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.

@jplatte
Copy link
Contributor

jplatte commented Apr 12, 2021

Duplicate of #298.

@sadraskol
Copy link
Author

Thanks for pointing out the duplicate, sorry to have duplicated it 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants