Poiché il numero può contenere fino a 15 cifre, dovrai eseguire il cast a un numero intero a 64 bit (8 byte). Prova questo:
SELECT * FROM table
WHERE myint = mytext::int8
Il :: cast operator è storico ma conveniente. Postgres è inoltre conforme alla sintassi standard SQL
myint = cast ( mytext as int8)
Se hai un testo letterale che vuoi confrontare con un int , trasmetti int al testo:
SELECT * FROM table
WHERE myint::varchar(255) = mytext