When a query can be routed to a single shard and sent directly to MySQL, column availability checks should be deferred to MySQL rather than resulting in an error at the vtgate planner.
Example:
select foo, bar
from user u, user_extra ue
where u.id = ue.user_id
Problem:
If vtgate is running without schema tracking, it may be unable to determine the tables to which columns like foo and bar belong, resulting in an ambiguous column error. However, because this query can be merged into a single route based on sharding key choices, it is unnecessary to perform these column checks at the vtgate level. Instead, we can rely on MySQL to handle column validation and return a meaningful error if any issues are found.
Proposed Solution:
Skip vtgate column validation for queries routed to a single shard and let MySQL manage column availability checks to avoid redundant errors.
When a query can be routed to a single shard and sent directly to MySQL, column availability checks should be deferred to MySQL rather than resulting in an error at the vtgate planner.
Example:
Problem:
If vtgate is running without schema tracking, it may be unable to determine the tables to which columns like
fooandbarbelong, resulting in an ambiguous column error. However, because this query can be merged into a single route based on sharding key choices, it is unnecessary to perform these column checks at the vtgate level. Instead, we can rely on MySQL to handle column validation and return a meaningful error if any issues are found.Proposed Solution:
Skip vtgate column validation for queries routed to a single shard and let MySQL manage column availability checks to avoid redundant errors.