Regexp expressions ignored
Reported by François Beausoleil | August 30th, 2007 @ 08:09 AM
Regular expression options (i for ignore case and so on) are ignored:
Party.select {|p| p.display_name =~ /beausoleil/i}.to_sql
Returns the following:
"SELECT * FROM parties WHERE parties.`display_name` REGEXP 'beausoleili'"
Note the extra 'i' at the end of the name.
Comments and changes to this ticket
-
Chris Wanstrath August 30th, 2007 @ 11:17 AM
- State changed from new to resolved
Does SQL accept flags? For now I'm just removing the flags.
Fixed in http://projects.require.errthebl... and in just-pushed gem 0.1.4
-
Matthew King August 31st, 2007 @ 07:45 AM
postgres has different regexp operators for case sensitive and case insensitive. Perhaps the flags could be tracked for use in adapter-specific regexes.
http://www.postgresql.org/docs/8.2/static/functions-matching.html#FUNCTIONS-POSIX-TABLE
-
Chris Wanstrath September 2nd, 2007 @ 12:39 PM
I added support for case insensitive / sensitive postgres operators.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »