yikkwong
yikkwong
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Thanks for the help 🙌
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Just to avoid accidentally breaking queries that uses undefined, and for people migrating from other drivers where undefined just works as params.
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Would be cool to have something that can transform undefined to null like in postgres.js, maybe at sql templating level instead of driver level, something like inlineParams?
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Modifying undefined at this point in time is a huge breaking change I supposed
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Casting to null would cause too many troubles
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Yeah it makes sense to ignore undefined if dynamic filters are widely used
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
This works select * from users where id = ${userId}${deletedUser ? sql.raw(' and deleted = true') : undefined}; since we cannot parametized the 2nd
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
I dont think this works in drizzle
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
I only used node-pg, but we have to do query and params separatedly
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
both node-pg (https://node-postgres.com/features/queries#parameterized-query) and postgres.js (https://github.com/porsager/postgres#transform-undefined-values) allows transformation of undefined values in parametized query while drizzle totally omit undefined value in params
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
I get it that undefined is converted to default in ORM queries, but when using sql`` templating, is undefined ignored for any good reason? Sorry if im missing something
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
Do you have more info on how drizzle treats undefined and null very differently?
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
No worries, just checking if there is any other way to do it more elegantly rather than casting to null or conditionally checking everytime
28 replies
DTDrizzle Team
Created by yikkwong on 10/28/2023 in #help
Broken query when parametized query is undefined
https://node-postgres.com/features/queries#parameterized-query node-pg convert both null and undefined to null
28 replies