Ashwin Kumar Sharma
2010-Jan-19 20:19 UTC
PGError: ERROR: operator does not exist: character = integer
Hi, I''m using PostgreSql database with the rails application,In a functionality I''m trying to compare two attributes in a condition, one is of type varchar and other the Integer. While doing so i''m getting the error as below. ActiveRecord::StatementInvalid: PGError: ERROR: operator does not exist: character = integer LINE 5: WHERE PART.part_number = UNIT.part_number::INT ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. I can''t change the data type of the columns but I need to compare the above condition. Can anyone help me out in solving the above. Thanks in advance. -- Posted via ruby-forum.com. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Jan-19 20:35 UTC
Re: PGError: ERROR: operator does not exist: character = integer
On Tue, Jan 19, 2010 at 12:19 PM, Ashwin Kumar Sharma <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> ActiveRecord::StatementInvalid: PGError: ERROR: operator does not exist: > character = integer > > LINE 5: WHERE PART.part_number = UNIT.part_number::INT > ^ > HINT: No operator matches the given name and argument type(s). You > might need to add explicit type casts.> I can''t change the data type of the columns but I need to compare the > above condition. Can anyone help me out in solving the above.Uh, did you try following that hint? If it didn''t really register you might try googling `postgres type cast` :-) HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en.