Skip to content

bug(clickhouse): switching schema corrupts IPv6 JDBC URLs #2685

Open

Description

@HandSonic

Chat2DB Edition

Chat2DB Community

Chat2DB Version

main at 2442df9

Deployment

Web and Desktop

Operating System

Any

Database and Version

ClickHouse with JDBC access over IPv6

Problem Summary

Switching a ClickHouse connection to another schema corrupts bracketed IPv6 JDBC URLs. ClickHouseDBManager splits the URL using the bare host and port as a regular expression, which cannot match the bracketed IPv6 authority and does not safely preserve URL query or fragment suffixes.

Steps to Reproduce

  1. Configure a ClickHouse connection with URL jdbc:clickhouse://[2001:db8::1]:8123/default?ssl=true.
  2. Store the connection host as 2001:db8::1 and port as 8123.
  3. Switch the connection schema to analytics.

Expected Behavior

The URL becomes jdbc:clickhouse://[2001:db8::1]:8123/analytics?ssl=true and remains stable on reconnect. Query parameters and ClickHouse fragment tags are preserved.

Actual Behavior

The host and port split does not match the bracketed authority. The implementation appends the bare address and schema to the existing URL, producing a malformed value such as jdbc:clickhouse://[2001:db8::1]:8123/default?ssl=true2001:db8::1:8123/analytics. The bad URL is then written back to ConnectInfo.

Logs

The ClickHouse driver rejects the malformed JDBC URL or connects with the wrong database.

Screenshots or Additional Context

ClickHouse supports schema switching and fragment tags. URL rewriting should replace only the database path while preserving the authority, query, and fragment boundaries.

Impact

IPv6 ClickHouse connections cannot reliably switch databases and reconnect attempts can reuse the corrupted URL.

Workaround

Manually restore the JDBC URL and avoid switching schemas from Chat2DB.

Submission Checklist

  • Reproduced on the selected Chat2DB edition.
  • Searched existing issues and pull requests for duplicates.
  • Removed credentials and private data.

Activity

  1. github-actions commented on Aug 11, 2026

    @github-actions

    Thanks for the detailed reproduction. I understand that switching a ClickHouse schema rewrites a bracketed IPv6 JDBC URL incorrectly, appending the bare host and new schema while failing to preserve the URL boundaries.

    The required Operating System Version field is missing. Please provide the exact OS and version for at least one environment where this was reproduced (and indicate whether it was the Web or Desktop deployment); that is the smallest remaining detail needed for a maintainer to proceed.

    Generated by AI Issue Assistant for #2685 · 7.99 AIC · ⌖ 2.71 AIC · ⊞ 16.7K · ◷

  2. moved this from Inbox to In Review in Chat2DB Communityon Aug 12, 2026
  3. moved this from In Review to Backlog in Chat2DB Communityon Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions