Skip to content

PgHasArrayType is not implemented for Vec<i64> #2611

@mrl5

Description

@mrl5

Bug Description

after upgrading to 0.7.0 I'm getting this error when using https://docs.rs/sqlx/latest/sqlx/trait.Type.html#transparent

error[E0277]: the trait bound `Vec<i64>: PgHasArrayType` is not satisfied
 --> src/lib.rs:1:10
  |
1 | #[derive(sqlx::Type)]
  |          ^^^^^^^^^^ the trait `PgHasArrayType` is not implemented for `Vec<i64>`
  |
  = help: the trait `PgHasArrayType` is implemented for `Vec<u8>`
  = help: see issue #48214
  = note: this error originates in the derive macro `sqlx::Type` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `sqlx-test2` (lib) due to previous error

Minimal Reproduction

cargo init --lib sqlx-test

src/lib.rs:

#[derive(sqlx::Type)]
#[sqlx(transparent)]
pub struct ScriptHashes(pub Vec<i64>);

Cargo.toml:

[package]
name = "sqlx-test2"
version = "0.1.0"
edition = "2021"

[dependencies]
sqlx = { version = "0.7.0", features = [
    "macros",
    "postgres",
] }

then

cargo build

Info

  • SQLx version: 0.7.0
  • SQLx features enabled: macros and postgres
  • Database server and version: Postgres 14 or 15
  • Operating system: linux
  • rustc --version: rustc 1.70.0 (90c541806 2023-05-31)

additional info

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions