1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Whitelist adapters that support aliases in HAVING clause

Support for using `SELECT` column or expression aliases in the `HAVING`
clause isn't part of the SQL standard so it's better to whitelist the
test for adapters where we know it works and skip it on others.
This commit is contained in:
Andrew White 2017-03-01 11:36:54 +00:00
parent 89d5d975e5
commit 3efad391e6

View file

@ -249,7 +249,7 @@ class CalculationsTest < ActiveRecord::TestCase
end end
def test_should_group_by_summed_field_having_condition_from_select def test_should_group_by_summed_field_having_condition_from_select
skip if current_adapter?(:PostgreSQLAdapter, :OracleAdapter) skip unless current_adapter?(:Mysql2Adapter, :SQLite3Adapter)
c = Account.select("MIN(credit_limit) AS min_credit_limit").group(:firm_id).having("min_credit_limit > 50").sum(:credit_limit) c = Account.select("MIN(credit_limit) AS min_credit_limit").group(:firm_id).having("min_credit_limit > 50").sum(:credit_limit)
assert_nil c[1] assert_nil c[1]
assert_equal 60, c[2] assert_equal 60, c[2]