Defect #5676

Search for Numeric Value

Added by Erich Rockman over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:2010-06-11
Priority:NormalDue date:
Assignee:Eric Davis% Done:

100%

Category:Search engine
Target version:1.0.0 (RC)
Resolution:Fixed Affected version:0.9.4

Description

I created a custom field of type LongText to hold a ticket number from a vendor. I created an issue and entered the value 4615713488 in the field. I made it searchable and filterable. However, when I search for the value 4615713488 from the search box on the top, it throws an Internal Server Error. This is the dump from the production.log:

Processing SearchController#index (for 192.168.21.66 at 2010-06-11 13:13:23) [GET]
  Parameters: {"action"=>"index", "id"=>"jrit", "issues"=>"1", "q"=>"567577567576", "controller"=>"search"}
  SQL (0.0ms)   SELECT max("settings".updated_on) AS max_updated_on FROM "settings" 
  User Load (0.0ms)   SELECT * FROM "users" WHERE ("users"."id" = 3) AND (users.status = 1) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) 
  Project Load (0.0ms)   SELECT * FROM "projects" WHERE ("projects"."identifier" = E'jrit') LIMIT 1
  Role Load (0.0ms)   SELECT * FROM "roles" WHERE ("roles"."builtin" = 1) LIMIT 1
  Member Load Including Associations (0.0ms)   SELECT "members"."id" AS t0_r0, "members"."user_id" AS t0_r1, "members"."project_id" AS t0_r2, "members"."created_on" AS t0_r3, "members"."mail_notification" AS t0_r4, "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, "roles"."id" AS t2_r0, "roles"."name" AS t2_r1, "roles"."position" AS t2_r2, "roles"."assignable" AS t2_r3, "roles"."builtin" AS t2_r4, "roles"."permissions" AS t2_r5 FROM "members" LEFT OUTER JOIN "projects" ON "projects".id = "members".project_id LEFT OUTER JOIN "member_roles" ON ("members"."id" = "member_roles"."member_id") LEFT OUTER JOIN "roles" ON ("roles"."id" = "member_roles"."role_id") WHERE ("members".user_id = 3 AND (projects.status=1)) ORDER BY projects.name
  Issue Load Including Associations (0.0ms)   PGError: ERROR: value "567577567576" is out of range for type integer
LINE 1: ...".id = "issues".project_id WHERE ("issues"."id" = E'56757756...

It appears to me that the system thinks it is an issue number because the value is numeric. However, it I put it in double quotes like this "4615713488" it returns the correct ticket. I cannot count on my users knowing to do that when searching for something.

Any advice?

5676_large_integer_search.diff Magnifier (1.25 KB) Holger Just, 2010-06-20 21:20

History

#1 Updated by Holger Just over 7 years ago

Postgres stumbles over the too large integer. Sqlite3 does not care. And I have no idea about mysql.

The attached patch should fix this.

#2 Updated by Eric Davis over 7 years ago

  • Status changed from New to Closed
  • Assignee set to Eric Davis
  • Target version set to 1.0.0 (RC)
  • % Done changed from 0 to 100
  • Resolution set to Fixed

Committed a fix in r3806. I could only reproduce this on Postgres 8.3, I think 8.4 changed this behavior.

Also available in: Atom PDF