drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
24.56k stars 646 forks source link

[BUG]: string values for limit causes issues but for offset they are ok #2782

Closed sombriks closed 3 weeks ago

sombriks commented 3 months ago

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

-

Describe the Bug

sometimes values for limit and offset came as string from requests, although they are perfectly valid numbers.

this doesn't seem to be an issue for offset, but for limit it causes lots of trouble.

it should not.

drizzle should be smart enough to figure the numbers, no matter the database engine.

for instance, for sqlite it throws an error, for postgres it simply ignores the limit/offset, returning all possible results.

Expected behavior

expect limit/offset to be honored

Environment & setup

see this gist for a sample https://gist.github.com/sombriks/a071d873a215b23f5532deee4622fe4e

goto3 commented 3 months ago

This is happening to me, in previous version 0.32.0 the limit value worked fine, now even with numbers it does not limit the query

L-Mario564 commented 3 weeks ago

You shouldn't be passing strings to limit nor offset. The input type for those are number | Placeholder.