Details

    Description

      SELECT 123 AS x is the same as SELECT 123 x. Extending to strings, SELECT '123' AS 'x' gives:

      MariaDB [test]> SELECT '123' AS 'x';
      +-----+
      | x   |
      +-----+
      | 123 |
      +-----+
      1 row in set (0.000 sec)
      

      Which is what one would expect.
      However, SELECT '123' 'x' yields an unexpected result:

      MariaDB [test]> SELECT '123' 'x';
      +------+
      | 123  |
      +------+
      | 123x |
      +------+
      1 row in set (0.001 sec)
      

      In the last example, the column name should match the returned value (123x or similar).

      Attachments

        Activity

          Gosselin Dave Gosselin added a comment - https://mariadb.com/kb/en/string-literals/
          danblack Daniel Black added a comment -

          Good to merge.

          danblack Daniel Black added a comment - Good to merge.

          Notes for the changelog: String literals that are next to each other are concatenated together, for example, select '123' 'x' will produce '123x'. When the string literal in the select list, its value will be used as column name. Before this fix, only the first literal is used for the name, '123'. After the fix, the result of the concatenation is used as the name, '123x'.

          psergei Sergei Petrunia added a comment - Notes for the changelog: String literals that are next to each other are concatenated together, for example, select '123' 'x' will produce '123x'. When the string literal in the select list, its value will be used as column name. Before this fix, only the first literal is used for the name, '123'. After the fix, the result of the concatenation is used as the name, '123x'.

          People

            Gosselin Dave Gosselin
            Gosselin Dave Gosselin
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.