Forum: Ruby on Rails SQL bug in acts_as_taggable

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.
Bf133ad38ecf6620b2dbb848bebd878d?d=identicon&s=25 Ugo Cei (Guest)
on 2006-03-21 18:36
(Received via mailing list)
Hi,

excuse me if this is off-topic and feel free to ingore it in case.

I'm using acts_as_taggable (the gem version) and found what to me
looks like a bug in this code from the method tags_count:

           sql = "SELECT #{t}.#{t_pk} AS id, #{t}.name AS name, COUNT
(*) AS count
FROM #{jt}, #{o}, #{t} WHERE #{jt}.#{t_fk} = #{t}.#{t_pk}
                 AND #{jt}.#{o_fk} = #{o}.#{o_pk}"
           sql << " AND #{sanitize_sql(options[:conditions])}" if
options[:condit
ions]
           sql << " GROUP BY #{t}.name"

My database (PostgreSQL 8) laments that the 'tags.id' column should
be in the "GROUP BY" clause, which seems reasonable to me. The last
line should be:

           sql << " GROUP BY #{t}.name, #{t}.#{t_pk}"

It seems strange, however, that I'm the only one to be bitten by this
bug, so I wonder if maybe some other database (MySQL?) lets this pass.

	Ugo


--
Ugo Cei
Blog: http://agylen.com/
Open Source Zone: http://oszone.org/
Evil or Not?: http://evilornot.info/
Company: http://www.sourcesense.com/
7cda78d70ab775710f6fa24e0a5b68db?d=identicon&s=25 Emin Hasanov (Guest)
on 2006-03-21 18:45
(Received via mailing list)
yes, mysql would handle this in most of the cases

good discovery for other databases though
9bbfd5444e969ec61c00fd37971f71f2?d=identicon&s=25 Ugo Cei (Guest)
on 2006-03-21 20:41
(Received via mailing list)
Il giorno 21/mar/06, alle ore 18:43, Emin Hasanov ha scritto:

> yes, mysql would handle this in most of the cases
>
> good discovery for other databases though

Unfortunately there's a bug open for a similar problem <http://
rubyforge.org/tracker/index.php?
func=detail&aid=2482&group_id=923&atid=3629> since last september, so
I don't think it's going to get fixed soon.

	Ugo
This topic is locked and can not be replied to.