hicknhack-software / redmine_time_tracker

A time tracker plugin for Redmine
Other
106 stars 32 forks source link

Autocompletion via issue ID doesn't work #189

Closed ghost closed 9 years ago

ghost commented 9 years ago

At least not with postgresql:

ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR:  function lower(integer) does not exist
LINE 1: ..._modules em WHERE em.name='issue_tracking')) AND (LOWER(issu...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: SELECT "issues"."id" AS t0_r0, "issues"."tracker_id" AS t0_r1, "issues"."project_id" AS t0_r2, "issues"."subject" AS t0_r3, "issues"."description" AS t0_r4, "issues"."due_date" AS t0_r5, "issues"."category_id" AS t0_r6, "issues"."status_id" AS t0_r7, "issues"."assigned_to_id" AS t0_r8, "issues"."priority_id" AS t0_r9, "issues"."fixed_version_id" AS t0_r10, "issues"."author_id" AS t0_r11, "issues"."lock_version" AS t0_r12, "issues"."created_on" AS t0_r13, "issues"."updated_on" AS t0_r14, "issues"."start_date" AS t0_r15, "issues"."done_ratio" AS t0_r16, "issues"."estimated_hours" AS t0_r17, "issues"."parent_id" AS t0_r18, "issues"."root_id" AS t0_r19, "issues"."lft" AS t0_r20, "issues"."rgt" AS t0_r21, "issues"."is_private" AS t0_r22, "issues"."closed_on" AS t0_r23, "projects"."id" AS t1_r0, "projects"."name" AS t1_r1, "projects"."description" AS t1_r2, "projects"."homepage" AS t1_r3, "projects"."is_public" AS t1_r4, "projects"."parent_id" AS t1_r5, "projects"."created_on" AS t1_r6, "projects"."updated_on" AS t1_r7, "projects"."identifier" AS t1_r8, "projects"."status" AS t1_r9, "projects"."lft" AS t1_r10, "projects"."rgt" AS t1_r11, "projects"."inherit_members" AS t1_r12 FROM "issues" LEFT OUTER JOIN "projects" ON "projects"."id" = "issues"."project_id" WHERE (projects.status <> 9 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (LOWER(issues.id) LIKE '%2%')):
ghost commented 9 years ago

Fixed it here: https://github.com/madeup/redmine_time_tracker/commit/1e25883640542c9e9a1c6fc0b736398319dbf2af

Also removed the lowercasing. I'm not entirely sure what changing case in a number was supposed to do in the first place.

ghost commented 9 years ago

Or rather fixed here: https://github.com/madeup/redmine_time_tracker/commit/121ecf72c688dbf66ff81d737803d2928b6a295e

(Looks like mysql doesn't know what a cast to varchar is, while for postgresql a char is a single-character type)

jume-dev commented 9 years ago

I fixed it with removing the lower for the id, which was kinda strange anyway ;) Anyway, thanks for looking into this.