Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.83k stars 108 forks source link

A bug is occurring in the query to get only empty data "NULL". #461

Open ryusei-48 opened 3 months ago

ryusei-48 commented 3 months ago

I am using TAURI to develop my application. Suppose you have a table with the following schema

model Clipboard {
  id              Int             @id @default(autoincrement())
  app_title       String
  process_id      Int
  text            String?
  rtf             String?
  html            String?
  image           Bytes?
  files           String?
  is_hold         Boolean         @default(false)
  update_at       DateTime        @updatedAt
  register_at     DateTime        @default(now())
}

So, for example, the following is a query to retrieve only the "image" columns for which data exists.

let result = state.storage.clipboard().find_many
    vec![ clipboard::image::not( None ) ]
).exec().await.unwrap();

This code actually works, but the odd thing is that if all the "image" columns are "NULL", then normally no records are returned, but for some reason all records are retrieved.

If there is at least one record with data in the "image" column, the aforementioned problem will not occur.

Is this a bug?

environment

rust version: 1.78 tauri = 1.6.7 prisma-client-rust = 0.6.11