Bug Report: Specifying database name in a query after shard targetting fails #17502
Labels
Component: Query Serving
Type: Enhancement
Logical improvement (somewhere between a bug and feature)
Overview of the Issue
If you specify a specific shard in your
USE
statement, such asuse commerce/-;
and then issue a sql statement with the database name in the query, such as,select * from commerce.corder;
, the query fails with an errorThis makes sense as vtgate just passes through the sql statement to the shard and the underlying database name in the shard is prefexed with
vt_
so this fails.But should this fail? as from end user pov, the database/keyspace name is
commerce
, so selecting a shard and explicitly specifying the database name in the query should work.To validate this theory, this query works.
VS
Reproduction Steps
Follow the steps in https://vitess.io/docs/22.0/get-started/operator/ to create a operator based vitess cluster on main branch.
Binary Version
vtgate --version vtgate version Version: 22.0.0-SNAPSHOT (Git revision aabf1c9b907691f3c26eab3d75ca123b66735bcc branch 'main') built on Thu Jan 9 10:06:25 UTC 2025 by vitess@buildkitsandbox using go1.23.4 linux/amd64
Operating System and Environment details
Log Fragments
No response
The text was updated successfully, but these errors were encountered: