You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
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:
issue USE <db> - should be same as calling Connection.setSchema()
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?
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.
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
Activity
zhicwu commentedon Dec 30, 2022
Hi @kassak, thanks for the report. I can reproduce the issue.
tjlee commentedon Jan 10, 2023
@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()afterusestatementszhicwu commentedon Jan 11, 2023
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:
USE <db>- should be same as callingConnection.setSchema()USEstatement - similar as aboveActually 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?
kassak commentedon Jan 11, 2023
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.
yanye666 commentedon Feb 5, 2023
ClickHouse does not support catalog, please use setSchema instead
zhicwu commentedon Mar 17, 2023
Sorry for getting back late. Now the driver supports both catalog and schema(change
databaseTermoption 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