Skip to content

Conversation

@mzitnik
Copy link
Contributor

@mzitnik mzitnik commented Apr 23, 2025

Summary

Solve 2327 - Does not escape correctly UUID

Closes #2327

Checklist

Delete items not relevant to your PR:

@sonarqubecloud
Copy link

@mshustov mshustov requested a review from Copilot April 23, 2025 13:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #2327 by fixing how UUID values are escaped before being inserted into a ClickHouse table. Key changes include adding a new test case that validates the UUID insertion and updating the encodeObject method in PreparedStatementImpl.java to handle UUIDs.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java Added a test case for inserting a UUID into a table
jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java Updated the encodeObject method to correctly escape UUID values
Comments suppressed due to low confidence (2)

jdbc-v2/src/test/java/com/clickhouse/jdbc/PreparedStatementTest.java:586

  • [nitpick] The test method name 'testWriteCollection' may be misleading as it primarily tests UUID insertion. Consider renaming it to something like 'testInsertUUID' for clarity.
void testWriteCollection() throws Exception {

jdbc-v2/src/main/java/com/clickhouse/jdbc/PreparedStatementImpl.java:657

  • Verify that returning the UUID as a quoted and escaped string is the intended behavior for ClickHouse's UUID type. If ClickHouse expects UUIDs in a different format (e.g. unquoted), adjust the escaping accordingly.
return "'" + escapeString(((UUID) x).toString()) + "'";

@chernser chernser merged commit df339eb into main Apr 23, 2025
25 checks passed
@chernser chernser deleted the issue-2327 branch April 23, 2025 17:16
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.

[jdbc-v2] PreparedStatement UUID instance parameter causes statement error

3 participants