diff options
author | david <david@nlpgo.com> | 2018-05-28 12:11:57 +0200 |
---|---|---|
committer | david <david@nlpgo.com> | 2018-05-28 12:11:57 +0200 |
commit | bbe3e7f298c1b99724f9b4c3b3cbc8778b210342 (patch) | |
tree | badf3f74fc0c81de56406d7cdd72cbc8e1d44df3 /activerecord | |
parent | 36390b6bdc75fca70e7a9d74c6270e3f40e77799 (diff) | |
download | rails-bbe3e7f298c1b99724f9b4c3b3cbc8778b210342.tar.gz rails-bbe3e7f298c1b99724f9b4c3b3cbc8778b210342.tar.bz2 rails-bbe3e7f298c1b99724f9b4c3b3cbc8778b210342.zip |
Fix: Arel Postgresql visitor generates invalid SQL for GROUPING SETS.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/arel/visitors/postgresql.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/arel/visitors/postgres_test.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/arel/visitors/postgresql.rb b/activerecord/lib/arel/visitors/postgresql.rb index 108ee431ee..c5110fa89c 100644 --- a/activerecord/lib/arel/visitors/postgresql.rb +++ b/activerecord/lib/arel/visitors/postgresql.rb @@ -5,7 +5,7 @@ module Arel # :nodoc: all class PostgreSQL < Arel::Visitors::ToSql CUBE = "CUBE" ROLLUP = "ROLLUP" - GROUPING_SET = "GROUPING SET" + GROUPING_SETS = "GROUPING SETS" LATERAL = "LATERAL" private @@ -67,7 +67,7 @@ module Arel # :nodoc: all end def visit_Arel_Nodes_GroupingSet(o, collector) - collector << GROUPING_SET + collector << GROUPING_SETS grouping_array_or_grouping_element o, collector end diff --git a/activerecord/test/cases/arel/visitors/postgres_test.rb b/activerecord/test/cases/arel/visitors/postgres_test.rb index ba37afecfb..ba9cfcfc64 100644 --- a/activerecord/test/cases/arel/visitors/postgres_test.rb +++ b/activerecord/test/cases/arel/visitors/postgres_test.rb @@ -229,7 +229,7 @@ module Arel it "should know how to visit with array arguments" do node = Arel::Nodes::GroupingSet.new([@table[:name], @table[:bool]]) compile(node).must_be_like %{ - GROUPING SET( "users"."name", "users"."bool" ) + GROUPING SETS( "users"."name", "users"."bool" ) } end @@ -237,7 +237,7 @@ module Arel group = Arel::Nodes::GroupingElement.new([@table[:name], @table[:bool]]) node = Arel::Nodes::GroupingSet.new(group) compile(node).must_be_like %{ - GROUPING SET( "users"."name", "users"."bool" ) + GROUPING SETS( "users"."name", "users"."bool" ) } end @@ -246,7 +246,7 @@ module Arel group2 = Arel::Nodes::GroupingElement.new([@table[:bool], @table[:created_at]]) node = Arel::Nodes::GroupingSet.new([group1, group2]) compile(node).must_be_like %{ - GROUPING SET( ( "users"."name" ), ( "users"."bool", "users"."created_at" ) ) + GROUPING SETS( ( "users"."name" ), ( "users"."bool", "users"."created_at" ) ) } end end |