Strange query like SELECT * FROM [Primary Key] = 0

I am use ROR v= 2.3.4

in my console. i found a strange query SELECT * FROM [Primary Key(id)]

because of i had changed the id[Primary Key] from int to varchar. ruby
rails still query the db on int like 0 use int not ‘0’.
such kind query cost too much db resource. and i don’t konw how to
such query.

please help.