Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6949

MySQL client does not recognize SET STATEMENT .. FOR USE <db name> as a schema change

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • N/A
    • N/A
    • OTHER
    • None

    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):

                          9 Query     SELECT DATABASE()
                          9 Init DB   mysql

      and it changes the DB name in the prompt if it's configured to be displayed.
      If it's run with auto-rehash, it additionally reads table names and field names.

      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.

      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 11
      Server version: 10.1.1-MariaDB-wsrep-debug-log Source distribution, wsrep_25.10.r4123
       
      Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [test]> show tables;
      +----------------+
      | Tables_in_test |
      +----------------+
      | t1             |
      | t2             |
      | t3             |
      | t4             |
      +----------------+
      4 rows in set (0.00 sec)
       
      MariaDB [test]> set statement lock_wait_timeout=1 for use mysql;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> -- attempt name completion with t<tab> and then choose t1
      MariaDB [test]> select * from t
      t1    t1.i  t2    t2.i  t3    t3.j  t4    t4.i  tee   test  tmp   
      MariaDB [test]> select * from t1;
      ERROR 1146 (42S02): Table 'mysql.t1' doesn't exist

      Current bb-10.1-set-statement tree

      commit e64f5d8f758bcc1a8856ba9fba01780533f80747
      Author: Oleksandr Byelkin <sanja@mariadb.com>
      Date:   Sun Oct 26 16:27:54 2014 +0100
       
          Fixed test suite global variable saving

      All the same in Percona server/client.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.