administrate: cast type in search (function lower text does not exist error)

Current search try to use lower() function in PG, thsi funciton only accepts an string since PG 8.4, so it will be a good idea to add coercion to the query to avoid problems with nil columns.

rewrite the quey to:

"lower(text(#{quote_attr(attr)})) LIKE ?"

is enough

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 18 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Yep, having this issue in one of my production apps right now.

PG::UndefinedFunction: ERROR: function lower(integer) does not exist LINE 1: ... "categories" WHERE (lower(name) LIKE '%something%' OR lower(insu... [Truncated]

thanks @nickcharlton! better late than never

Sadly this took 18 months to be fixed so it undermined trust in Adminsitrate for me. If Thoughtbot has not the resources to take care of this project I will suggest to open it’s control to the community so it can regain some trust.

Regards

Not to self: fix this.

@helsayed We’ve not yet released a version with this fix in, but I’m doing the final few passes over issues before I do. In the meantime, I’d suggest bundling from the git repo.