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: make setObject accept UUID array #2587

Merged
merged 2 commits into from Aug 12, 2022
Merged

fix: make setObject accept UUID array #2587

merged 2 commits into from Aug 12, 2022

Conversation

sasavilic
Copy link
Contributor

@sasavilic sasavilic commented Aug 11, 2022

Hello,

pgjdbc has had issue for some time that calling .setObject on PreparedStatement only works for some kind of arrays (arrays listed in ArrayEncoding.ARRAY_CLASS_TO_ENCODER. Unfortunately, UUID is not in that list.

Using stmt.setArray(parameterPosition, con.createArrayOf("uuid", myUuidArray)) works, but unfortunately connection can sometimes be buried deep in multiple abstraction layers and not really accessible to caller (i.e. when using spring NamedParameterJdbcTemplate).

Since I am not deeply familiar with pgjdbc design philosophy, I tried to make something that could be useful starting point for proper fix, but I am sure that maintainers will have better and more elegant way of solving this issue.

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?
    Yes, at least tests relevant to my changes that I could run locally.
  2. Does ./gradlew autostyleCheck checkstyleAll 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.
    I hope not.
  • 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?

@@ -0,0 +1,139 @@
/*
* Copyright (c) 2021, PostgreSQL Global Development Group
Copy link
Member

Choose a reason for hiding this comment

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

2022

@davecramer
Copy link
Member

Update the copyright and I'll merge this

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.

None yet

2 participants