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
- Cast all search queries to text. All Postgres versions since 8.4 require this to be a string. This casts the table and column to be strings as it's possible that the column name is nil. Fixes #620. — committed to thoughtbot/administrate by nickcharlton 6 years ago
- Cast all search queries to text. All Postgres versions since 8.4 require this to be a string. This casts the table and column to be strings as it's possible that the column name is nil. Fixes #620. — committed to thoughtbot/administrate by nickcharlton 6 years ago
- Cast all search queries to text. All Postgres versions since 8.4 require this to be a string. This casts the table and column to be strings as it's possible that the column name is nil. Fixes #620. — committed to thoughtbot/administrate by nickcharlton 6 years ago
- Cast all search queries to text. (#1079) All Postgres versions since 8.4 require this to be a string. This casts the table and column to be strings as it's possible that the column name is nil. ... — committed to thoughtbot/administrate by nickcharlton 6 years ago
Yep, having this issue in one of my production apps right now.
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.