Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: null pointer exception from PgResultSetMetaData when there's no column metadata #1615

Merged
merged 2 commits into from Dec 5, 2019

Conversation

@IvyDev0
Copy link
Contributor

IvyDev0 commented Nov 22, 2019

As described in #1613 and a previous PR #663, the driver throws null pointer exception when building the results for queries without column metadata, e.g. SELECT <x> FROM <table name> <x>, where <x> is not a column name but an alias of the table. It should just return the whole table. (There might be other queries that can also reproduce this issue.)

However the above PR only fix one place where field.getMetadata() is null. There are four more places might cause the NPE.
In this minor fix, we return "" as the columnName, schemaName, tableName if the metadata is null, and ResultSetMetaData.columnNullable for nullable.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Does mvn checkstyle:check pass ?
  3. Have you added your new test classes to an existing test suite in alphabetical order?

Changes to Existing Features:

  • Does this break existing behaviour? If so please explain.
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?
@AppVeyorBot

This comment has been minimized.

Copy link

AppVeyorBot commented Nov 22, 2019

@davecramer

This comment has been minimized.

Copy link
Member

davecramer commented Nov 22, 2019

Thanks!

@davecramer davecramer closed this Nov 22, 2019
@davecramer

This comment has been minimized.

Copy link
Member

davecramer commented Dec 5, 2019

Now I'm wondering why I closed it ?

@davecramer davecramer reopened this Dec 5, 2019
@davecramer davecramer merged commit 08bd46b into pgjdbc:master Dec 5, 2019
1 check was pending
1 check was pending
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.