How to filter length in where for postgres?

I have a text field, which I want to select only if it's length is higher than 50. How should I do that? So I basically need to transfer where length(item.content) >= 50 to Drizzle.
2 Replies
Andrii Sherman
.where(sql`length(${item.content}) >= 50`)
.where(sql`length(${item.content}) >= 50`)
Or like this if you need to escape dynamic value
.where(sql`length(${item.content}) >= ${50}`)
.where(sql`length(${item.content}) >= ${50}`)
content column from item table will be automatically escaped
mmurto
mmurtoOP2y ago
Thanks a lot!
Want results from more Discord servers?
Add your server