镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

USE statement does nothing #1160

Closed
Closed

Description

@kassak
driver version: 0.3.2-patch11
ClickHouse: 21.12.4.1

New implementation of driver does not change the schema stored inside the connection, so the statements after USE are executed in schema that was originally configured in the settings

Example:

use system;
select currentDatabase();
use default;
select currentDatabase();

Activity

  1. zhicwu commented on Dec 30, 2022

    @zhicwu
    Contributor

    Hi @kassak, thanks for the report. I can reproduce the issue.

  2. tjlee commented on Jan 10, 2023

    @tjlee

    @zhicwu I can reproduce the issue too. Maybe we missed something in steps to reproduce, do you need any help?

    In image you can see that driver returns invalid value for currentDatabase() after use statements
    In image you can see that driver returns invalid value for current database

  3. zhicwu commented on Jan 11, 2023

    @zhicwu
    Contributor

    Thank you @tjlee for additional inputs. I plan to fix this together with TCL support to close #975.

    Yes I do need help :) Are we expecting to change schema at Connection level? There are two typical scenarios:

    1. issue USE <db> - should be same as calling Connection.setSchema()
    2. issue multi-statement query which contains USE statement - similar as above

    Actually I thought about applying the change at Statement level especially for the second one, but it's probably inconsistent with other database drivers. Any suggestion?

  4. kassak commented on Jan 11, 2023

    @kassak
    Author

    inconsistent with other database drivers

    Yes that would be inconsistent and unexpected, especially for interactive tools)
    From my experience I can say:
    The current schema is usually not applied while sending the statement to db, and maintained solely by the database.
    Some drivers do cache it from the database responses.

  5. added this to the 0.4.1 release milestone on Jan 18, 2023
  6. yanye666 commented on Feb 5, 2023

    @yanye666

    ClickHouse does not support catalog, please use setSchema instead

  7. linked a pull request that will close this issuenew option for catalog support #1283on Mar 16, 2023
  8. reopened this on Mar 16, 2023
  9. zhicwu commented on Mar 17, 2023

    @zhicwu
    Contributor

    Sorry for getting back late. Now the driver supports both catalog and schema(change databaseTerm option to switch) and each time you change current database(either catalog or schema, depending databaseTerm option), the driver will check existence of the database.

    I don't have DataGrip license, so I only verified the change on DBeaver. Appreciate if you can use latest nightly build at here to double check.

    Update: and you probably want to check if DataGrip has similar issue as in dbeaver/dbeaver#19404

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions