Add in clause support for selectDBA statement#8360
Closed
bravehearto0 wants to merge 5 commits intovitessio:mainfrom
Closed
Add in clause support for selectDBA statement#8360bravehearto0 wants to merge 5 commits intovitessio:mainfrom
bravehearto0 wants to merge 5 commits intovitessio:mainfrom
Conversation
Signed-off-by: bravehearto0 <shiruisheng88@gmail.com>
Signed-off-by: bravehearto0 <shiruisheng88@gmail.com>
Signed-off-by: bravehearto0 <shiruisheng88@gmail.com>
Signed-off-by: bravehearto0 <shiruisheng88@gmail.com>
Signed-off-by: bravehearto0 <shiruisheng88@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
support correct parsing for the following scenarios for select DBA statement :
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN ('commerce');
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN ('commerce', 'product');
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_SCHEMA,TABLE_NAME) IN (('commerce', 'product'));
select table_schema, table_name, column_name from information_schema.columns where (table_schema, table_name, lower(column_name)) in (('milkyway_production', 'user_uploaded_media', 'uuid'));
Noticed that due to the vttableschema and vttablename is still limited to 1, the actual query execution of above one may return
lessthan what should be returned. The reason is vtgate using a map to track the overiden schema & table name, which could be only one. Further fix needed to make it work end to end.Originally the code normalize the query
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN ('commerce', 'product');
to
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN ::__vtg1;
this is undesired, because we need to rewrite the query to
"Query": "select * from INFORMATION_SCHEMA.
TABLESwhere TABLE_SCHEMA in (:__vtschemaname, :__vtschemaname)","SysTableTableSchema": "[VARBINARY("commerce"), VARBINARY("product")]"
There are two ways to fix this:
After implementing both, I found the 2 is less risky and has much less impact than 1.