Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Find by a null time doesn't work #486

Closed
matthewmueller opened this issue Feb 13, 2020 · 4 comments
Closed

Find by a null time doesn't work #486

matthewmueller opened this issue Feb 13, 2020 · 4 comments
Assignees
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. topic: types
Milestone

Comments

@matthewmueller
Copy link
Contributor

matthewmueller commented Feb 13, 2020

create table events (
  id serial not null primary key,
  "time" timestamp with time zone
);
insert into events ("time") values (NULL);
insert into events ("time") values (NULL);
insert into events ("time") values (NULL);
client.events.findMany({ where: { time: null } })

Expect 3 fields, don't get any back.

@matthewmueller matthewmueller added the process/candidate Candidate for next Milestone. label Feb 13, 2020
@janpio janpio added bug/1-repro-available A reproduction exists and needs to be confirmed. kind/bug A reported bug. labels Feb 13, 2020
@pantharshit00
Copy link
Contributor

I received a rust panic when I tried the above:
image

 const data = await client.events.findMany(Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: FromSql(1), cause: Some(WrongType { postgres: Type(Timestamptz), rust: "core::option::Option<alloc::string::String>" }) }) })
    at PrismaClientFetcher.request (/Users/harshit/code/reproductions/issue-matt-2/node_modules/@prisma/client/index.js:89:17)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:8290) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8290) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
 const data = await client.events.findMany(Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: FromSql(1), cause: Some(WrongType { postgres: Type(Timestamptz), rust: "core::option::Option<alloc::string::String>" }) }) })
    at PrismaClientFetcher.request (/Users/harshit/code/reproductions/issue-matt-2/node_modules/@prisma/client/index.js:89:17)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:8290) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8290) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Schema:

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://xxxxx:xxxxxx@localhost:5432/matt-2?schema=public"
}

model events {
  id   Int       @id
  time DateTime?
}

Version: prisma2@2.0.0-alpha.781, binary version: a1a562d6f7093ae4ac17ebe3c8d2b387b2ed0598

@pantharshit00 pantharshit00 added bug/2-confirmed We have confirmed that this is a bug. and removed bug/1-repro-available A reproduction exists and needs to be confirmed. labels Feb 14, 2020
@pantharshit00 pantharshit00 removed their assignment Feb 14, 2020
@divyenduz divyenduz added this to the Preview 23 milestone Feb 14, 2020
@divyenduz divyenduz removed the process/candidate Candidate for next Milestone. label Feb 18, 2020
@janpio janpio modified the milestones: Preview 23, Preview 24 Mar 3, 2020
@divyenduz divyenduz modified the milestones: Preview 24 Old, Preview 25 Mar 13, 2020
@janpio
Copy link
Member

janpio commented Mar 16, 2020

Can you please reconfirm this @pantharshit00? @tomhoule recently fixed some stuff related to timestamps, so maybe this returns a different error message now.

@dpetrick
Copy link

Unable to reproduce on the query-engine level.

Datamodel:

model Event {
  id   Int       @id
  time DateTime?
}

After firing a bunch of mutations with and without time set:

mutation {
  createOneEvent(data: {
    id: 5
    time: "2020-03-17T13:32:09"
  }) {
    id
    time
  }
}

I am able to get only events with time: null as following:

{
  findManyEvent(where: {
    time: null
  }) {
    id
    time
  }
}

@pantharshit00
Copy link
Contributor

Unable to reproduce as well in preview024. Closing

@pantharshit00 pantharshit00 removed their assignment Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. topic: types
Projects
None yet
Development

No branches or pull requests

6 participants