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

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

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

            Transition Time In Source Status Execution Times
            Elena Stepanova made transition -
            Open Confirmed
            18m 49s 1
            Varun Gupta (Inactive) made transition -
            Confirmed In Progress
            1d 23h 1
            Varun Gupta (Inactive) made transition -
            In Progress In Review
            6d 19h 36m 1
            Michael Widenius made transition -
            In Review Stalled
            162d 3h 52m 1
            Varun Gupta (Inactive) made transition -
            Stalled Closed
            2d 20h 20m 1

            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.