I took a look at simplifying this test case, and I think it comes down to data types:
maciek=# select 9/10; ?column? ---------- 0 (1 row) maciek=# select pg_typeof(10); pg_typeof ----------- integer (1 row) But: maciek=# select 9/1e1; ?column? ------------------------ 0.90000000000000000000 (1 row) maciek=# select pg_typeof(1e1); pg_typeof ----------- numeric (1 row) Does that explain the behavior you're seeing?