workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

[BUG] D1 `EXISTS` Query Fails to Parse Bool

Open cyypherus opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What version of workers-rs are you using?

0.5.0

What version of wrangler are you using?

3.99.0

Describe the bug

Using .first with this type of query fails to parse the result as a bool.

db
        .prepare("SELECT EXISTS(SELECT 1 FROM users WHERE email = $1)")
        .bind(&[email.to_string().into()])
        .unwrap()
        .first::<bool>(None)
        .await

Steps To Reproduce

  1. Setup a d1 db with a schema that allows you to use an exists query
  2. Attempt to run the code in the description

Parsing fails

cyypherus avatar Jan 02 '25 22:01 cyypherus