Hi,

I'm reporting a minor, long-standing, edge case in intarray here.

Namely, when parsing a query_int, the strtol base is set to 0, which forces
the base auto-detection mode.

Consequently, when a zero-padded integer input is provided, the number is
interpreted as an octal value, which in turn leads to wrong int-query results

postgres=# select '010'::query_int;
 query_int
-----------
 8
(1 row)

postgres=# select '{10}'::int[] @@ '010'::query_int;
 ?column?
----------
 f
(1 row)

I believe this is not the intended behavior; attached is a small patch that
sets the base to decimal instead (and adds the above as a regression test).

Thanks,
Marko

Attachment: 0001-intarray-Parse-query_int-integers-as-decimals.patch
Description: Binary data

Reply via email to