Skip to content

Regression in double precision column -> int conversion: "Bad value for type int : 2" #2748

@Gekkio

Description

@Gekkio

Describe the issue

Calling ResultSet.getInt() on a column that contains the double precision ("float8") value 2.0 fails with an exception due to a copy-paste error in #2719

The constant LONG_MAX_VALUE is incorrectly derived from Long.MIN_VALUE, which breaks the bounds check during conversion: https://github.com/pgjdbc/pgjdbc/pull/2719/files#diff-7e93771092eab9084402e3c7c81319a1f037febdc7614264329bd29f11d39ef2R3380

Driver Version?

42.5.2

Java Version?

17

OS Version?

Pop!_OS 22.04 LTS

PostgreSQL Version?

14.6

To Reproduce
Steps to reproduce the behaviour:

  • return 2.0 :: double precision from any query and try to call ResultSet.getInt() on the corresponding column

Expected behaviour

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions