Skip to content

Fix all com_init_db and mysql client related issue with use <dbname>#6157

Merged
harshit-gangal merged 5 commits intovitessio:masterfrom
planetscale:fix-init-db
May 7, 2020
Merged

Fix all com_init_db and mysql client related issue with use <dbname>#6157
harshit-gangal merged 5 commits intovitessio:masterfrom
planetscale:fix-init-db

Conversation

@harshit-gangal
Copy link
Copy Markdown
Member

Fixes: #6153
Fixes: #3060

mysql -h 127.0.0.1 -P 9727 --database=ks:80-                                              
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.9-Vitess (Ubuntu)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from t3;
+-----+------+------+
| id5 | id6  | id7  |
+-----+------+------+
|   3 |    4 |    3 |
+-----+------+------+
1 row in set (0.00 sec)

mysql> select database();
+------------+
| database() |
+------------+
| ks:80-     |
+------------+
1 row in set (0.00 sec)

mysql> use `ks:-80`;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select database();
+------------+
| database() |
+------------+
| ks:-80     |
+------------+
1 row in set (0.01 sec)

mysql> select * from t3;
+-----+------+------+
| id5 | id6  | id7  |
+-----+------+------+
|   1 |    2 |    3 |
|   2 |    2 |    3 |
|   4 |    5 |    4 |
+-----+------+------+
3 rows in set (0.01 sec)

mysql> use ks;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from t3;
+-----+------+------+
| id5 | id6  | id7  |
+-----+------+------+
|   1 |    2 |    3 |
|   2 |    2 |    3 |
|   4 |    5 |    4 |
|   3 |    4 |    3 |
+-----+------+------+
4 rows in set (0.03 sec)

mysql> use unknowndb;
ERROR 1049 (42000): vtgate: http://harshit-X1:9725/: Unknown database 'unknowndb' (errno 1049) (sqlstate 42000)
mysql> select database();
+------------+
| database() |
+------------+
| ks         |
+------------+
1 row in set (0.00 sec)

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
… work

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal requested a review from sougou as a code owner May 7, 2020 14:13
@harshit-gangal harshit-gangal changed the title Fix: All ComInitDB / Mysql Client Related issue with use <dbname> Fix all com_init_db and mysql client related issue with use <dbname> May 7, 2020
Copy link
Copy Markdown
Collaborator

@systay systay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@deepthi
Copy link
Copy Markdown
Collaborator

deepthi commented May 7, 2020

Finally! 🎉

@harshit-gangal harshit-gangal merged commit e019bc7 into vitessio:master May 7, 2020
@deepthi deepthi added this to the v7.0 milestone Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regression: use doesn't work from mysql client 'USE' doesn't return an error if a keyspace doesn't exist

3 participants