[MDEV-6949] MySQL client does not recognize SET STATEMENT .. FOR USE <db name> as a schema change Created: 2014-10-27 Updated: 2014-11-08 Resolved: 2014-11-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | N/A |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
MySQL client does not recognize the change of schema via SET STATEMENT ... FOR USE <db name>. On normal USE <db name> it does at least the following (example for USE mysql):
and it changes the DB name in the prompt if it's configured to be displayed. For SET STATEMENT ... FOR USE ... it does none of those. The default schema is still changed, but the client doesn't know about it – the prompt shows the old name, name completion does not work etc.
All the same in Percona server/client. |
| Comments |
| Comment by Sergei Golubchik [ 2014-11-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
USE db is mysql command line client command, it is not sent to the server. As you have pointed out yourself, there is no "USE" statement in the general log, so "USE" was not sent to the server as an SQL statement. It was run as a protocol level command. But if you put it into SET STATEMENT ... FOR then the client doesn't recognize it and it is sent as an SQL statement. Basically you change the database behind mysql command client back, it doesn't know the database was changed. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-11-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
That's exactly what the bug was about, that the client does not recognize the command. It wasn't a report about the server (yeah we still don't have the category "Client").
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2014-11-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There's no easy way of fixing it. There was a similar issue with DROP DATABASE. It was fixed by extending the protocol — the server sets the SERVER_STATUS_DB_DROPPED flag when a database is dropped and the client can do something about it (mysql command line client re-reads the current database in this case). A clean fix for this issue would be to extend the protocol again and add SERVER_STATUS_DB_CHANGED. But I'm not sure this issue is worth the troubles. |