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
Andrii Sherman15mo ago
.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
mmurto15mo ago
Thanks a lot!