Martnart
Martnart
Explore posts from servers
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
Thank you
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
Sure, I'll do that
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
I am not sure how to properly handle it. At the very least I would expect a Warning box in the docs to say "if you need high precision, don't go for Date"
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
It is the default mode after all
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
But it totally breaks expected behavior in this case.
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
2023-08-30 18:35:58.540306 vs 2023-08-30T18:36:37.151Z
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
Mode: string
Query: select "id", "customer_id", "descriptor", "status", "created_at", "started_at", "completed_at", "error" from "task" "tasks" where ("tasks"."descriptor" = $1 and "tasks"."customer_id" = $2 and "tasks"."created_at" > $3) limit $4 -- params: ["something", "c4185562-4d45-4e2a-a75d-9ba886f31838", "2023-08-30 18:35:58.540306", 1]
Query: select "id", "customer_id", "descriptor", "status", "created_at", "started_at", "completed_at", "error" from "task" "tasks" where ("tasks"."descriptor" = $1 and "tasks"."customer_id" = $2 and "tasks"."created_at" > $3) limit $4 -- params: ["something", "c4185562-4d45-4e2a-a75d-9ba886f31838", "2023-08-30 18:35:58.540306", 1]
Mode: Date
Query: select "id", "customer_id", "descriptor", "status", "created_at", "started_at", "completed_at", "error" from "task" "tasks" where ("tasks"."descriptor" = $1 and "tasks"."customer_id" = $2 and "tasks"."created_at" > $3) limit $4 -- params: ["something", "c4185562-4d45-4e2a-a75d-9ba886f31838", "2023-08-30T18:36:37.151Z", 1]
Query: select "id", "customer_id", "descriptor", "status", "created_at", "started_at", "completed_at", "error" from "task" "tasks" where ("tasks"."descriptor" = $1 and "tasks"."customer_id" = $2 and "tasks"."created_at" > $3) limit $4 -- params: ["something", "c4185562-4d45-4e2a-a75d-9ba886f31838", "2023-08-30T18:36:37.151Z", 1]
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
But that still doesn't explain though, why a gt operator returns the same result it is comparing against. Note that the bug is not only that it doesn't return secondThing but that it does return firstThing the very value of which I was gting against
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
In pgAdmin I can see that the stored timestamp of secondThing is greater than the one of firstThing. I would expect this to be my ground truth in regards to sql queries. If I change the timestamp's mode to string it works. I'm assuming there's some precision lost in the conversion to a js Date?
27 replies
DTDrizzle Team
Created by Martnart on 8/30/2023 in #help
where(gt) with timestamp returns wrong result
Seeing that I couldn't find anything else in the discord regarding that, I have created an issue: https://github.com/drizzle-team/drizzle-orm/issues/1148
27 replies
DTDrizzle Team
Created by Martnart on 4/27/2023 in #help
Check for empty string in postgres
Anyway, great job that you guys are doing. Looking forward to a bright future with drizzle 🙂
7 replies
DTDrizzle Team
Created by Martnart on 4/27/2023 in #help
Check for empty string in postgres
Thanks for prompt reply. I was a bit confused because it is already being used in the test file linked above.
7 replies