Skip to content

fix: Issue #3784 pgjdbc can't decode numeric arrays containing special numbers like NaN#3838

Merged
davecramer merged 2 commits intopgjdbc:masterfrom
ShenFeng312:master
Oct 31, 2025
Merged

fix: Issue #3784 pgjdbc can't decode numeric arrays containing special numbers like NaN#3838
davecramer merged 2 commits intopgjdbc:masterfrom
ShenFeng312:master

Conversation

@ShenFeng312
Copy link
Contributor

fix #3784

@ShenFeng312
Copy link
Contributor Author

cc @davecramer

@ShenFeng312
Copy link
Contributor Author

ping @davecramer

@davecramer davecramer merged commit 7745db9 into pgjdbc:master Oct 31, 2025
16 of 17 checks passed
}
};

private static final ArrayDecoder<BigDecimal[]> BIG_DECIMAL_STRING_DECODER = new AbstractObjectStringArrayDecoder<BigDecimal[]>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems non-passive. Am I missing something?

arr = rs.getArray(2);
assertEquals(Types.NUMERIC, arr.getBaseType());
BigDecimal[] decarr = (BigDecimal[]) arr.getArray();
Number[] decarr = (Number[]) arr.getArray();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does seem non passive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well there's no other way to represent NaN. It does pass all of our tests,
Do you want to revert this ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It passes the tests after changing them.
The existing (unchanged) tests failed with a class cast exception.
I think it does need to be reverted.

We have discussed the lack of support for these special values in the past. It has been longstanding.

There are not great options.
1 would be a config for how to support/map numeric arrays.
2 would be to dynamically adjust the array type based on presence of these special values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bokken Hello, I have resubmitted the PR according to your instructions. Could you please help me review it #3888

@ShenFeng312
Copy link
Contributor Author

@bokken Hello, I have resubmitted the PR according to your instructions. Could you please help me review it #3888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pgjdbc can't decode numeric arrays containing special numbers like NaN

3 participants

Comments