#70 ✓resolved

Problems with counting when using priority_order_by

Reported by kgiszczak | March 23rd, 2009 @ 10:18 AM

Hi, this BUG is related to ticket #1.

When I want to use @search.priority_order_by = :dic_posting_status_id, page_links helper throw this error:

PGError: ERROR:  column "postings.dic_posting_status_id" must appear in the GROUP BY clause or be used in an aggregate function
: SELECT count("postings".id) AS count_id FROM "postings" INNER JOIN employer_accounts ON postings.employer_account_id = employer_accounts.id WHERE (("employer_accounts".company_type = E'Employer') AND ("employer_accounts".company_id = 2)) ORDER BY "postings"."dic_posting_status_id"

There is no need of using order by in counting statement.

(Exactly the same problem was in ticket #1, but for standard 'order_by' option)

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson March 30th, 2009 @ 11:55 AM

    • State changed from “new” to “open”

    Can you please create a failing test(s), and then I can fix the issue. By test, I mean a test I can run in the searchlogic test suite. I apologize for asking you to do this, but its a new policy I am implementing with my open source projects. I am just very busy and this would help me easily knock out the issue.

  • kgiszczak

    kgiszczak April 1st, 2009 @ 04:11 AM

    Hi, Ben

    I wrote this test, but it works with sqlite adapter. I changed adapter to postgresql, and this test fails. Also there's more tests which fail with postgresql adapter.

    I'm not shure what to do next, should I send you changes I made, or commit this changes to github.

    I'm waiting for some advice, thanks.

  • kgiszczak

    kgiszczak April 14th, 2009 @ 07:00 AM


    I fixed this in my fork: http://github.com/kgiszczak/sear...

    I added also test, but it works only on postgresql adapter (I mean this test always pass on sqlite adapter, regardless of this fix, and now, after the fix, this test also pass on postgresql adapter, earlier this test fails, on postgresql adapter)

  • Ben Johnson

    Ben Johnson April 16th, 2009 @ 03:14 AM

    • State changed from “open” to “resolved”

    Awesome, this has been applied. Thanks for taking the time to do this, it makes my life a lot easier.

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 ยป

Provides common named scopes and object based searching.

People watching this ticket