# Rom-sql: Using string::lower() comparison with an array

**URL:** <https://discourse.rom-rb.org/t/rom-sql-using-string-lower-comparison-with-an-array/365>\
**Category:** Issues\
**Created:** [May 4, 2020, 4:10pm UTC](https://discourse.rom-rb.org/t/rom-sql-using-string-lower-comparison-with-an-array/365 "2020-05-04T16:10:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![renatolond](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/renatolond/32/191_2.png) [@renatolond](https://discourse.rom-rb.org/u/renatolond)\
**Post date:** [May 4, 2020, 4:10pm UTC](https://discourse.rom-rb.org/t/rom-sql-using-string-lower-comparison-with-an-array/365/1 "2020-05-04T16:10:23Z")

</div>

Hi!

I’m using ROM v5.1.2 with rom-sql 3.1.0 acessing a postgresql database.

From the code, I understand that there’s some cases in which room supports a call to `.is()` with an array: [https://github.com/rom-rb/rom-sql/blob/4611a760d594c6e3f2ee471462bc8add27df293f/spec/unit/function\_spec.rb#L74-L75](https://github.com/rom-rb/rom-sql/blob/4611a760d594c6e3f2ee471462bc8add27df293f/spec/unit/function_spec.rb#L74-L75)  
However, if I try to do something like:  
root.where { string::lower(field).is([“value1”, “value2”]) }  
In one of my repositories, I get the error:  
Caused by PG::UndefinedFunction: ERROR: operator does not exist: text = record  
LINE 1: …" FROM “table” WHERE (LOWER(“table”.“field”) = ('value1…  
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.

Is this a bug? Or I’m doing something not support by functions in the where clause?

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/solnic/32/279_2.png) [@solnic](https://discourse.rom-rb.org/u/solnic)\
**Post date:** [May 20, 2020, 9:10am UTC](https://discourse.rom-rb.org/t/rom-sql-using-string-lower-comparison-with-an-array/365/2 "2020-05-20T09:10:25Z")

</div>

Hey, sorry for late reply. This looks like a bug. It should create an `IN` clause instead of using `=`. Could you report it please?

---

<div class="post-metadata">

**Author:** ![renatolond](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/renatolond/32/191_2.png) [@renatolond](https://discourse.rom-rb.org/u/renatolond)\
**Post date:** [May 27, 2020, 7:37am UTC](https://discourse.rom-rb.org/t/rom-sql-using-string-lower-comparison-with-an-array/365/3 "2020-05-27T07:37:53Z")

</div>

Done, thanks!

> <https://github.com/rom-rb/rom-sql/issues/376>
>
> Describe the bug
> When using string:lower() in a where statement, if the comparison is with an array, the comparison fails.
> To Reproduce
> Assuming a...
