This snippet of PHP code:
$x = 107629173119941611714; var_dump($x); var_dump((int) $x);
...produces this output:
float(1.0762917312E+20) int(0)
So this has nothing to do with PostgreSQL nor how Anewt handles database result sets. The numbers you're using are just too big to fit in a PHP integer value.
This snippet of PHP code:
$x = 107629173119941 611714;
var_dump($x);
var_dump((int) $x);
...produces this output:
float( 1.0762917312E+ 20)
int(0)
So this has nothing to do with PostgreSQL nor how Anewt handles database result sets. The numbers you're using are just too big to fit in a PHP integer value.