Column name must be quoted
Created by: sanami
Search fails in postgres if any column name is not all downcased/
https://github.com/thoughtbot/administrate/blob/master/lib/administrate/search.rb#L23
it should be
def query
search_attributes.map do |attr|
"lower(#{ ActiveRecord::Base.connection.quote_column_name(attr) }) LIKE ?"
end.join(" OR ")
end
https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other. (The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, foo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.)