Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for a bogus issue #207 leads to regression in a working code #209

Closed
pkit opened this issue Jun 27, 2023 · 1 comment
Closed

Fix for a bogus issue #207 leads to regression in a working code #209

pkit opened this issue Jun 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@pkit
Copy link

pkit commented Jun 27, 2023

In the issue #207 the user dropped default database without a ClickHouse restart.
Which is not supported by CH, see source code on global context.
User must set the new default database name in the server settings.
And user must restart the whole server.

Now in a default scenario of c = create_client()
c.database is None and not default
Which leads to any code relying on the default to fail.

@pkit pkit added the bug Something isn't working label Jun 27, 2023
@genzgd
Copy link
Collaborator

genzgd commented Jun 27, 2023

Do you know of any code actually relying on a value of Client.database?. None of the client methods rely on this value since all functionality must operate correctly in the user's default database which ClickHouse will use if the database parameter is not specified. If the user actually needs that value, they can substitute the currentDatabase() function in their query or use a client.command(SELECT currentDatabase()) to get it. (The better argument is that Client.database should be a private _database property, since it's intended use is internal functionality, but that would be even more of a breaking change.)

Also, in addition to the situation where the default was dropped without resetting the server wide default_database setting, the previous code was broken even if the just default_database for the specified user was dropped. While in theory the operator should not do that, it's cleaner and more user friendly to remove the unnecessary and possibly invalid currentDatabase() call, and not break existing clients or client applications with confusing error messages.

@genzgd genzgd closed this as completed Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants