0
I’m making a pagination filter in cakephp, but when I type in a phone number to search, it returns the following error:
Error: SQLSTATE[42883]: Undefined Function: 7 ERROR: Operator does not exist: bigint ~~* Unknown LINE 1: ...
om"."status_id_destino") WHERE "User"."telefone" ILIKE '%53
... ^HINT: No Operator Matches the Given name and argument type(s). You Might need to add Explicit type Casts.
Any amount I type in this field, I get this error!
(NOTE: Other filters work normally, only this is a field INTEGER
that is not working)
Edited: Adding excerpt from the consultation:
SELECT "User"."id", "User"."telefone", "User"."email" .... etc ...
FROM "public"."users" AS "User" .... etc ...
WHERE "User"."telefone" ILIKE '%5332733535%'
AND "Home"."ativo" = 'TRUE'
AND "Home"."status_id_destino"
IN (1, 2, 3, 4, 5, 6, 7, 8, 9)
ORDER BY "Ose"."id" asc LIMIT 20
Put the query Techo with the problem, phone is Varying Character?
– rray
telefone
is of the integer type. !– Marcos Henzel
Phone should not an integer, for two reasons, first if you have an 0800 will have problems because the zero left will disappear. An integer represents an amount (something countable) a phone is not countable, it should be a Varying Character, not to apply a
LIKE/ILIKE
in an integer or numeric type. I suggest you change the column type or create a new one, otherwise try to cast before calling theilike
– rray
Hmmm, okay, thanks for the suggestions. ...
WHERE "User"."telefone"::varchar ILIKE ......
??– Marcos Henzel
More or less that, I’m not sure if he’ll accept the
varchar
– rray
Doing the search manually it worked that way, now I’m trying to apply in the code. As soon as I have a return I put here. thanks again!
– Marcos Henzel
If you are interested see: CPF or CNPJ field type in VARCHAR or INT database? is practically the same problem (data type).
– rray
Perfect @rray! !
– Marcos Henzel