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

query! macro produces invalid code for TIME[] arrays #840

Closed
msrd0 opened this issue Nov 22, 2020 · 0 comments · Fixed by #845
Closed

query! macro produces invalid code for TIME[] arrays #840

msrd0 opened this issue Nov 22, 2020 · 0 comments · Fixed by #845

Comments

@msrd0
Copy link
Contributor

msrd0 commented Nov 22, 2020

The following code statement produces a compile error, where times is a Vec<chrono::NaiveTime>:

query!("SELECT UNNEST($1::TIME[])", &times);

The compile error is

error[E0433]: failed to resolve: could not find `sqlx` in `types`
  --> src/routing/submission.rs:87:2
   |
87 |     query!("SELECT UNNEST($1::TIME[])", &times);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `sqlx` in `types`
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused import: `&`
  --> src/routing/submission.rs:87:38
   |
87 |     query!("SELECT UNNEST($1::TIME[])", &times);
   |                                         ^
   |
   = note: `#[warn(unused_imports)]` on by default

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0433`.

Running cargo expand, this seems to be the problematic part:

                        let ty_check = sqlx::ty_match::WrapSame::<
                            &[sqlx::types::sqlx::types::chrono::NaiveTime],
                            _,
                        >::new(&_expr)
                        .wrap_same();

From my Cargo.toml file:

sqlx = { version = "0.4.1", features = ["runtime-tokio-rustls", "postgres", "macros", "chrono"], default-features = false }
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

Successfully merging a pull request may close this issue.

1 participant