Skip to content

[Enhancement] java mysql jdbc cannot obtain the primary key information of the table #31206

Closed

Description

@waywtdcc

Search before asking

  • I had searched in the issues and found no similar issues.

Description

CREATE TABLE IF NOT EXISTS cc_test.example_tbl_unique2
(
user_id LARGEINT NOT NULL COMMENT "用户id",
username VARCHAR(50) NOT NULL COMMENT "用户昵称",
city VARCHAR(20) COMMENT "用户所在城市"
)
UNIQUE KEY(user_id)
DISTRIBUTED BY HASH(user_id) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

DatabaseMetaData metaData = dbConn.getMetaData();
ResultSet rs = metaData.getPrimaryKeys(“cc_test”, null, "example_tbl_unique2");

result is empty.

image

Solution

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. ihadoop commented on Feb 21, 2024

    @ihadoop

    let me see whether doris Implement that method in server side

  2. liugddx commented on Feb 21, 2024

    @liugddx
    Member

    Use ·SHOW FULL COLUMNS from cc_test.example_tbl_unique2·

  3. ihadoop commented on Feb 21, 2024

    @ihadoop

    mysql jdbc driver use command "show key from xx.xxx" to get PK.doris don't implement method,and then return EMPTY_SET

  4. Isaac-Whiz commented on Feb 21, 2024

    @Isaac-Whiz

    In the sample code, it shows that you support catalogs use
    ResultSet rs = metaData.getPrimaryKeys(null, "cc_test", "example_tbl_unique2");

  5. waywtdcc commented on Feb 22, 2024

    @waywtdcc
    Author

    mysql jdbc driver use command "show key from xx.xxx" to get PK.doris don't implement method,and then return EMPTY_SET

    Is there any plan to support this? I can try to submit a PR

  6. github-actions commented on Sep 13, 2025

    @github-actions
    Contributor

    We're closing this issue because it hasn't been updated in a while.
    If you'd like to revive this issue, please reopen it and feel free a maintainer to remove the Stale tag!

  7. added a commit that references this issue on Aug 14, 2026
    8f53149
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions