#333 open
Joseph Ridgway

has_filter :categorized with PostgreSQL

Reported by Joseph Ridgway | September 18th, 2009 @ 05:16 PM

Filtering articles (or albums etc) by category doesn't work with PostgreSQL installed. PostgreSQL doesn't allow "#{table_name}.id" in the group by clause like MySQL does. Rather, each column must be listed. I've tried fixing this but didn't get far. If I understood the method better I might get further. Any help?

This can be found in vendor/adva/engines/adva_cms/vendor/plugins/has_filter/lib/has_filter/active_record/act_macro.rb.

Error below:

PGError: ERROR: column "contents.site_id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT contents., COUNT() AS count FROM "contents" INNER...

           ^

: SELECT contents., COUNT() AS count FROM "contents" INNER JOIN "categorizations" ON "categorizations".categorizable_id = "contents".id AND "categorizations".categorizable_type = E'Content' INNER JOIN "categories" ON "categories".id = "categorizations".category_id WHERE (((categories.id IN(E'4')) AND ("contents".section_id = 1)) AND ("contents".section_id = 1)) AND ( ("contents"."type" = 'Article' ) ) GROUP BY contents.id HAVING count(*) >= 1 ORDER BY contents.position, contents.id DESC, contents.published_at DESC LIMIT 25 OFFSET 0

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<p>Cutting edge cms, blog, wiki, forum ... plattform.</p>

<p>Find the code on <a href="http://github.com/svenfuchs/adva_cms/tree/master">GitHub: adva cms</a></p>

<p>Part of the business application framework <a href="http://www.advabest.org/">adva best</a>.</p>

Pages