A small modification at ActiveRecord's calculations.rb

5 views
Skip to first unread message

Michalis P

unread,
Aug 10, 2008, 2:38:17 PM8/10/08
to Ruby on Rails: Core
Hello,

I'm not sure if this is the right channel to write this message. but
by adding

line 208 : sql << ") AS #{aggregate_alias}_subquery" if use_workaround

More legitimate sql code is generated, and a bug for the newly
developed and distributed MonetDB adapter is solved.

MonetDB prints this message :

!subquery table reference needs alias, use AS xxx in: "select count(*)
as count_all from (select distinct "accounts".id from "accounts" left
outer join "companies" on "companies".id = "accounts".firm_id and
"companies"."type" = 'Firm' where (companies.id > 1) );"

Could this modification be added in the ActiveRecord code?

Thanks,
Michalis Polakis

Frederick Cheung

unread,
Aug 10, 2008, 2:57:06 PM8/10/08
to rubyonra...@googlegroups.com

Hi Michalis,

You're in the right place for this sort of stuff :-)
Best thing to do is to stick a patch up at rails.lighthouseapp.com
(and then post the link to that ticket here)

Fred
> Thanks,
> Michalis Polakis
> >

Michalis P

unread,
Aug 10, 2008, 4:20:06 PM8/10/08
to Ruby on Rails: Core
It is ticket number : 796
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/796
thanks

On Aug 10, 9:57 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:

Frederick Cheung

unread,
Aug 11, 2008, 6:21:50 AM8/11/08
to rubyonra...@googlegroups.com

On 10 Aug 2008, at 21:20, Michalis P wrote:

Hi Michalis,

you should really put it in the form of a patch file, so everyone
knows exactly what you're talking about. I assume that this doesn't
break any tests for any of the other databases?
There's a quick howto on patches here: http://rails.lighthouseapp.com/projects/8994/sending-patches

Fred

Michalis P

unread,
Aug 11, 2008, 12:46:46 PM8/11/08
to Ruby on Rails: Core
Hi Frederick,

sorry for not doing it the proper way, I really didn't have time to
devote in it.
However Tom Ward created a patch for it, and it has been already
commited by Michael Koziarski.
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/796
As far as I am aware, it shouldn't create any problem; it is more
legitimate sql code anyway. I haven't tested it against other adapters
though, and at the moment I can't really remember which
test generated such a query.

Michalis

On Aug 11, 1:21 pm, Frederick Cheung <frederick.che...@gmail.com>
Reply all
Reply to author
Forward
0 new messages