Actions
Patch #24296
closedAdd tablename to siblings query to prevent AmbiguousColumn errors
Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:
0%
Estimated time:
Description
Problem¶
I creating a plugin that show siblings for issue. And when I try to get "visible" siblings for issue I get the next error:
ActionView::Template::Error (PG::AmbiguousColumn: ERROR: column reference "id" is ambiguous LINE 1: ...ot_id" = $1 AND "issues"."parent_id" IS NULL AND (id <> 2) A... ^ : SELECT "issues".* FROM "issues" INNER JOIN "projects" ON "projects"."id" = "issues"."project_id" WHERE "issues"."root_id" = $1 AND "issues"."parent_id" IS NULL AND (id <> 2) AND (projects.status <> 9 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) ORDER BY "issues"."lft" ASC):
This error can be reproduced in console by typing:
Issue.last.siblings.visible
Environment¶
Environment: Redmine version 3.3.1.stable Ruby version 2.3.1-p112 (2016-04-26) [x86_64-darwin16] Rails version 4.2.7.1 Environment development Database adapter PostgreSQL SCM: Subversion 1.9.4 Git 2.10.1 Filesystem
Fix¶
Adding tablename to siblings query fix the problem.
Files
Updated by Go MAEDA about 8 years ago
- Target version set to Candidate for next minor release
Updated by Jean-Philippe Lang about 8 years ago
- Subject changed from Add tablename to siblings query to Add tablename to siblings query to prevent AmbiguousColumn errors
- Category set to Code cleanup/refactoring
- Assignee set to Jean-Philippe Lang
- Target version changed from Candidate for next minor release to 3.2.5
Patch committed, thanks.
Updated by Jean-Philippe Lang about 8 years ago
- Status changed from New to Resolved
Updated by Jean-Philippe Lang almost 8 years ago
- Status changed from Resolved to Closed
Actions