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
Problem with query result on db different than the default #12489
Comments
probably the same as #10471
|
@den-crane I understand, but from our point of view, this looks like rather as a critical bug, because the query is a run in the wrong database. Especially when some kind of ORM is in usage is really inconvenient to replace the usual table name with table and database name. Are you planning to change this behavior? If this is a duplicate I could close it and watch appropriate issue. |
It's non obvious how to solve it because there is no guarantee that the database exists on the remote server. |
Maybe we can always substitute the current database when sending a query to remote server? |
@alexey-milovidov Are there any plans for this issue? |
No. It is in "discussion" stage. |
One more option is to pass the current database with query and make the target server look fist in that db, and later in it's default database. |
We have a problem with data counted for a specific query run in DB another than
default
in our ClickHouse cluster (sharding and replication).Describe the bug
We have two DBs:
default
andtest
.In each DB we have the same tables:
foo
(ReplicatedMergeTree)bar
(Distributed onbar_shard
) andbar_shard
(ReplicatedMergeTree)We fill tables with the same data:
foo
, separately on each shardbar
, by a distributed tableWe run the query:
SELECT count(something_else) FROM bar WHERE something_else IN (SELECT something FROM foo);
default
result count looks as expectedtest
result count is equal to count of items frombar_shard
(notbar
as we expect)Maybe there is some misunderstanding from our side, but for DB
default
works just as we expected, only with DB different thandefault
we face the issue.How to reproduce
I've scripted the reproduction steps on the LTS version 20.3.10.75. Please see https://github.com/nfpp/another_db_issue_repro. It creates the DBs and tables, inserts some data, and performs the queries.
Expected behavior
The same result of query regardless of DB in usage.
Additional context
For us, it looks like the query is partially counted on the
default
shard (withoutdefault
DB in the cluster, the query fails).Temporary we fix it by replacing
foo
by"{db_name}".foo
in the query.Worth to mention that with
GLOBAL IN
result is correct, but we by design put those data on eachshard
separately.The text was updated successfully, but these errors were encountered: