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

alias do not exist and a query do not report an error

    XMLWordPrintable

Details

    Description

      There is a complex query where there is a internal subquery with no alias reported anywhere and there is not error fire once the query run.

      Tested a simple case:

      MariaDB [test]> select user from mysql.user m where user in (select user from mysql.user m2 group by s.id);
      +---------------+
      | user          |
      +---------------+
      | data_engineer |
      | ro1           |
       
      as you see there is no alias for 's' table.
       
      MariaDB [test]> explain extended select user from mysql.user m where user in (se
      lect user from mysql.user m2 group by s.id);
      +------+--------------+-------------+-------+---------------+---------+---------
      +------+------+----------+------------------------------------------------------
      --------+
      | id   | select_type  | table       | type  | possible_keys | key     | key_len
      | ref  | rows | filtered | Extra
              |
      +------+--------------+-------------+-------+---------------+---------+---------
      +------+------+----------+------------------------------------------------------
      --------+
      |    1 | PRIMARY      | <subquery2> | ALL   | distinct_key  | NULL    | NULL
      | NULL |   20 |   100.00 |
              |
      |    1 | PRIMARY      | m           | index | NULL          | PRIMARY | 420
      | NULL |   20 |   100.00 | Using where; Using index; Using join buffer (flat, BN
      L join) |
      |    2 | MATERIALIZED | m2          | index | NULL          | PRIMARY | 420
      | NULL |   20 |   100.00 | Using index
              |
      +------+--------------+-------------+-------+---------------+---------+---------
      +------+------+----------+------------------------------------------------------
      --------+
      3 rows in set, 1 warning (0.023 sec)
      MariaDB [test]> show warnings\G
      *************************** 1. row ***************************
        Level: Note
         Code: 1003
      Message: select `mysql`.`m`.`User` AS `user` from `mysql`.`user` `m` semi join (
      `mysql`.`user` `m2`) where `mysql`.`m`.`User` = `mysql`.`m2`.`User`
      1 row in set (0.001 sec)
      

      So there is no alias and it should fire an error.

      Attachments

        Issue Links

          Activity

            People

              varun Varun Gupta (Inactive)
              massimo.disaro Massimo
              Votes:
              1 Vote for this issue
              Watchers:
              6 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.