# Does acts\_as\_taggable work with Oracle?

**URL:** <https://www.ruby-forum.com/t/does-acts-as-taggable-work-with-oracle/105971>\
**Category:** Rails\
**Created:** [June 5, 2007, 3:58am UTC](https://www.ruby-forum.com/t/does-acts-as-taggable-work-with-oracle/105971 "2007-06-05T03:58:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b4bc9f/32.png) [@Duane](https://www.ruby-forum.com/u/Duane)\
**Post date:** [June 5, 2007, 3:58am UTC](https://www.ruby-forum.com/t/does-acts-as-taggable-work-with-oracle/105971/1 "2007-06-05T03:58:49Z")

</div>

I’m using acts\_as\_taggable just fine with my Oracle database using the  
oci driver, until I try to either use the tags\_count, or tagged\_related.

For tags\_count I can get the default hash table fine, but if I try to  
provide a filter like “count \> 3”, I get an error:

Content.tags\_count(:count=\>’\>3’)

ActiveRecord::StatementInvalid: OCIError: ORA-00904: “COUNT”: invalid  
identifier  
: SELECT tags.id AS id, tags.name AS name, COUNT(\*) AS count FROM  
contents\_tags,  
content\_table, tags WHERE contents\_tags.tag\_id = tags.id  
AND contents\_tags.content\_id = content\_table.content\_id  
GROUP BY  
tags.id,tags.name HAVING count \>3 ORDER BY count DESC  
from  
C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_re  
cord/connection\_adapters/abstract\_adapter.rb:120:in `log' from C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_re cord/connection_adapters/oracle_adapter.rb:271:in`execute’  
from  
C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_re  
cord/connection\_adapters/oracle\_adapter.rb:473:in `select' from C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_re cord/connection_adapters/oracle_adapter.rb:262:in`select\_all’  
from  
C:/newruby/lib/ruby/gems/1.8/gems/acts\_as\_taggable-2.0.2/lib/taggab  
le.rb:339:in `tags\_count’  
from (irb):24

This should be allowed, from the docs:

+:count+: Adds a HAVING clause to the SQL statement, where you can set  
conditions for the ‘count’ column. For example: ‘\> 50’

But Oracle doesn’t like the final result. Is there some special tweak  
I’m supposed to make to the HAVING clause work properly?

D

---

<div class="post-metadata">

**Author:** ![Duane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b4bc9f/32.png) [@Duane](https://www.ruby-forum.com/u/Duane)\
**Post date:** [June 20, 2007, 7:28pm UTC](https://www.ruby-forum.com/t/does-acts-as-taggable-work-with-oracle/105971/2 "2007-06-20T19:28:17Z")

</div>

This may interest you:

[http://www.oracle.com/technology/pub/articles/kern-rails-tagging.html](http://www.oracle.com/technology/pub/articles/kern-rails-tagging.html)
