Skip to content

PostgreSQL querys don't support arrays containing nullable items #3775

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

Open
C0D3-M4513R opened this issue Mar 9, 2025 · 0 comments
Open
Labels

Comments

@C0D3-M4513R
Copy link

C0D3-M4513R commented Mar 9, 2025

I have found these related issues/pull requests

I didn't find any

Description

The code provided in the reproduction steps fails to compile with:

error[E0308]: mismatched types
  --> src/main.rs:44:17
   |
44 | "#, &[1, 2, 3], &[Some(true), Some(false), None]).fetch_all(db).await;
   |                 ^
   |                 |
   |                 expected `&[bool]`, found `&[Option<bool>; 3]`
   |                 expected due to the type of this binding
   |
   = note: expected reference `&[bool]`
              found reference `&[std::option::Option<bool>; 3]`

Reproduction steps

let r = sqlx::query!(r#"
SELECT * FROM unnest(
    $1::bigint[],
    $2::bool[]
  ) AS t(
    user_id,
    admin
)
"#, &[1, 2, 3], &[Some(true), Some(false), None]).fetch_all(db).await;

SQLx version

0.8.3

Enabled SQLx features

["postgres", "runtime-tokio-rustls"]

Database server and version

postgres (PostgreSQL) 16.6

Operating system

Linux nixos-pc 6.12.16 #1-NixOS SMP PREEMPT_DYNAMIC Fri Feb 21 13:01:47 UTC 2025 x86_64 GNU/Linux

Rust version

rustc 1.85.0 (4d91de4e4 2025-02-17)

@C0D3-M4513R C0D3-M4513R added the bug label Mar 9, 2025
@C0D3-M4513R C0D3-M4513R changed the title PostgreSQL querys doesn't support arrays containing nullable items PostgreSQL querys don't support arrays containing nullable items Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant