Forum: Ruby on Rails SQL query different on production server than dev server

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2007-02-24 03:40
(Received via mailing list)
I'm having an odd problem on the production server that does not occur
in development.

I'm using the TextSearch code from here:
http://wiki.rubyonrails.org/rails/pages/TextSearch
to search on my Product model.

In development, when I search for "Ruby R." via my form, I get this
code:


Processing SearchController#results (for 127.0.0.1 at 2007-02-24
12:27:18) [POST]

  Parameters: {"search_terms_form"=>"ruby rails", "commit"=>"Search",
"action"=>"results", "controller"=>"search"}
SELECT * FROM products WHERE (((lower(title) like '%ruby%' or
lower(description) like '%ruby%' or lower(author) like '%ruby%' or
lower(isbn) like '%ruby%' or lower(publisher) like '%ruby%') and
(lower(title) like '%rails%' or lower(description) like '%rails%' or
lower(author) like '%rails%' or lower(isbn) like '%rails%' or
lower(publisher) like '%rails%')))

However, the very same code in production gives this bizarre code:

Processing SearchController#results (for 203.51.51.225 at 2007-02-24
12:24:12) [POST]

  Parameters: {"search_terms_form"=>"ruby rails", "commit"=>"Search",
"action"=>"results", "controller"=>"search"}
SELECT * FROM products WHERE
(((lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(title)))))))))))))))))
like '%ruby%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(description)))))))))))))))))
like '%ruby%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(author)))))))))))))))))
like '%ruby%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(isbn)))))))))))))))))
like '%ruby%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(publisher)))))))))))))))))
like '%ruby%') and
(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(title)))))))))))))))))
like '%rails%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(description)))))))))))))))))
like '%rails%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(author)))))))))))))))))
like '%rails%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(isbn)))))))))))))))))
like '%rails%' or
lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(lower(publisher)))))))))))))))))
like '%rails%')))

Now, the first query runs perfectly.

I'm at a loss as to how the same code generates such different
queries.

Any clues appreciated.

Richard S.
This topic is locked and can not be replied to.