提交 f3938cd7 编写于 作者: V vanderhoorn

PostgreSQL bugfix for invalid SQL in subqueries

In commit 68a95542 the last_column feature of ToSql was removed. The visit_Arel_Nodes_Matches and visit_Arel_Nodes_DoesNotMatch methods are overwritten in the PostgreSQL class, but were not updated appropriately. This commit fixes the issue accordingly.

This bug affects at least all update_all statements in Rails 4.0.2 that have subqueries with ILIKE statements on PostgreSQL. The bug is present in Arel 4.0.1 and later, so it probably affects most Rails 4.0.2 projects.

It would be highly appreciated if Arel 4 could get a point release as well. Thanks for your continued work.
上级 f0ba9e4e
......@@ -4,10 +4,12 @@ class PostgreSQL < Arel::Visitors::ToSql
private
def visit_Arel_Nodes_Matches o, a
a = o.left if Arel::Attributes::Attribute === o.left
"#{visit o.left, a} ILIKE #{visit o.right, a}"
end
def visit_Arel_Nodes_DoesNotMatch o, a
a = o.left if Arel::Attributes::Attribute === o.left
"#{visit o.left, a} NOT ILIKE #{visit o.right, a}"
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册