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

expected struct sqlx::Any, found struct sqlx::Postgres #1458

Closed
Tristaan opened this issue Sep 28, 2021 · 1 comment
Closed

expected struct sqlx::Any, found struct sqlx::Postgres #1458

Tristaan opened this issue Sep 28, 2021 · 1 comment

Comments

@Tristaan
Copy link

When using the query! macro and when trying to fetch a row or fetch multiple the error in the title happens:

error[E0271]: type mismatch resolving `<&Pool<sqlx::Any> as Executor<'_>>::Database == sqlx::Postgres`
  --> src/models/users.rs:32:14
   |
32 |             .fetch_all(pool)
   |              ^^^^^^^^^ expected struct `sqlx::Any`, found struct `sqlx::Postgres`

I expected Any to work with any database. What am I doing wrong? because i'm not exactly sure what's happening behind the scenes.

@abonander
Copy link
Collaborator

abonander commented Sep 29, 2021

The macros generate code that requires a connection of the same kind of database as the DATABASE_URL you compiled with.

There's currently no way to tell the macros to generate code using the Any driver but we were discussing a way to do it in #964

I'm gonna close this as a duplicate of that issue.

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