Coder Social home page Coder Social logo

Postgres Error about agiledwarf HOT 4 OPEN

iressources avatar iressources commented on September 26, 2024
Postgres Error

from agiledwarf.

Comments (4)

Maltaman avatar Maltaman commented on September 26, 2024

1+
ActiveRecord::StatementInvalid (PG::Error: FEHLER: Spalte »issues.tracker_id« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
LINE 1: SELECT issues.*, sum(hours) as spent FROM "issues" left join...

: SELECT issues.*, sum(hours) as spent FROM "issues" left join time_entries ON time_entries.issue_id = issues.id WHERE (issues.project_id = 30 and status_id = 1 and assigned_to_id = 6) GROUP BY issues.id ORDER BY case when issues.ir_position is null then 1 else 0 end ASC, case when issues.ir_position is NULL then issues.id else issues.ir_position end ASC):

Select with * (all_fields from issues) but in the group_by is only issues.id

from agiledwarf.

Leeto2 avatar Leeto2 commented on September 26, 2024

I don't think it was your migration. I'm seeing the same thing when clicking on either the Run Charts or the Tasks tab.
Redmine: 2.12
Postgres: 8.4
Agile Dwarf: 0.0.3
Centos 5.x
Jruby: 1.6.8


Started GET "/adtasks/list?project_id=myproject" for 192.168.1.1 at Wed Nov 07 17:50:10 UTC 2012
Processing by AdtasksController#list as HTML
Parameters: {"project_id"=>"myproject"}
Current user: leeto2 (id=42)
Completed 500 Internal Server Error in 282ms

ActiveRecord::StatementInvalid (ActiveRecord::JDBCError: ERROR: column "issues.tracker_id" must appear in the GROUP BY clause or be used in an aggregate function
Position: 8: SELECT issues.*, sum(hours) as spent FROM "issues" left join time_entries ON time_entries.issue_id = issues.id WHERE (issues.project_id = 13 and status_id = 1 and fixed_version_id = '134' and assigned_to_id = 42) GROUP BY issues.id ORDER BY case when issues.ir_position is null then 1 else 0 end ASC, case when issues.ir_position is NULL then issues.id else issues.ir_position end ASC):
arjdbc/jdbc/RubyJdbcConnection.java:191:in `execute'


I'm new to Ruby. How can I figure out what module has the query in it? (short of doing a search and grepping for it.
Anything else I can do to help?

Thanks,
Leeto2

from agiledwarf.

arsphl avatar arsphl commented on September 26, 2024

Hello,

I did not have time to look at this myself.

But from the error message I read that basically the Adtask Controller in
the list command is miss behaving.

In SQL you have to have all fields upon which you apply calculus in the
group by list of fields. You also have add the accompanying fields. So by
stating issues.* next to a sum() I guess postgres want you you add all
those fields to the group by definition.

I would need to look at the data base to be sure. Postgres is much more
rigid about this sort of things than mysql.

You can have a look here to give you ideas :

http://stackoverflow.com/questions/1769361/postgresql-group-by-different-from-mysql

http://practiceovertheory.com/blog/2009/09/23/postgresql-s-group-by/

Personally I would rewrite the query to conform with standard SQL and
treat mysql as the exception. Otherwise if I connect the plugin to an
other database like Oracle, you will end up with the same issue.

Cheers,

I don't think it was your migration. I'm seeing the same thing when
clicking on either the Run Charts or the Tasks tab.
Redmine: 2.12
Postgres: 8.4
Agile Dwarf: 0.0.3
Centos 5.x
Jruby: 1.6.8


Started GET "/adtasks/list?project_id=myproject" for 192.168.1.1 at Wed
Nov 07 17:50:10 UTC 2012
Processing by AdtasksController#list as HTML
Parameters: {"project_id"=>"myproject"}
Current user: leeto2 (id=42)
Completed 500 Internal Server Error in 282ms

ActiveRecord::StatementInvalid (ActiveRecord::JDBCError: ERROR: column
"issues.tracker_id" must appear in the GROUP BY clause or be used in an
aggregate function
Position: 8: SELECT issues.*, sum(hours) as spent FROM "issues" left
join time_entries ON time_entries.issue_id = issues.id WHERE
(issues.project_id = 13 and status_id = 1 and fixed_version_id = '134'
and assigned_to_id = 42) GROUP BY issues.id ORDER BY case when
issues.ir_position is null then 1 else 0 end ASC, case when
issues.ir_position is NULL then issues.id else issues.ir_position end
ASC):
arjdbc/jdbc/RubyJdbcConnection.java:191:in `execute'


I'm new to Ruby. How can I figure out what module has the query in it?
(short of doing a search and grepping for it.
Anything else I can do to help?

Thanks,
Leeto2


Reply to this email directly or view it on GitHub:
#44 (comment)

Cordialement,

Philippe Laliberté
[email protected]
http://www.linkedin.com/in/plaliberte
+1 418 478 2055

from agiledwarf.

Leeto2 avatar Leeto2 commented on September 26, 2024

Fixed the Tasks issue. It's a hack but it works. Edit \AgileDwarf\app\models\sprints_tasks.rb
Find SprintsTasks.Find and look for group ==>
change it to this: (note the double quotes has been changed to single tics.):
:group => issues.id,issues.tracker_id,issues.project_id,issues.subject,issues.description,issues.due_date,issues.category_id,issues.status_id,issues.assigned_to_id,issues.priority_id,issues.fixed_version_id,issues.author_id,issues.lock_version,issues.created_on,issues.updated_on,issues.start_date,issues.done_ratio,issues.estimated_hours,issues.parent_id,issues.root_id,issues.lft,issues.rgt,issues.is_private,issues.ir_position',

from agiledwarf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.