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

ERROR 1054 Unknown column 'ID' in 'field list' exists on 10.4, but doesn't exist on 10.3

Details

    Description

      Preconditions: MariaDB 10.4.12 is installed from your package without any additional server changes.
      Only information_schema, mysql and performance_schema are available after installation. No user databases are present.
      All actions are performed with the root user.
      Steps to reproduce:
      1. Run the command line and execute the command:
      "C:\Program Files\MariaDB 10.4\bin\mysql.exe" -u root -p root
      2. Execute the script (see attachment) with the command: source D:/Script.sql
      Actual result:
      ERROR 1054 (42S22) at line 40 in file: 'D:\Script.sql': Unknown column 'ID' in 'field list'

      Expected result:
      If we do the same steps on MariaDB10.3.22, this script is successfully completed.

      Attachments

        1. screenshot-1.png
          screenshot-1.png
          34 kB
        2. screenshot-2.png
          screenshot-2.png
          51 kB
        3. Script.sql
          3 kB

        Activity

          The error seems to be correct though, isn't it? ID indeed isn't defined in the function/package, and the statement it's used in doesn't refer to any table.

          The simplified example is this:

          CREATE FUNCTION f() RETURNS INT RETURN ID;
          

          In 10.4, it throws an error upon function creation:

          10.4 edc3899d97

          MariaDB [test]> CREATE FUNCTION f() RETURNS INT RETURN ID;
          ERROR 1054 (42S22): Unknown column 'ID' in 'field list'
          

          but in 10.3 it only throws the error upon function call:

          10.3 811e4409c

          MariaDB [test]> CREATE FUNCTION f() RETURNS INT RETURN ID;
          Query OK, 0 rows affected (0.024 sec)
           
          MariaDB [test]> SELECT f();
          ERROR 1054 (42S22): Unknown column 'ID' in 'order clause'
          

          The difference was introduced in 10.4.0. We could find what exactly caused it, there was extensive refactoring in parser and around it, but I'm not sure it makes much sense. The behavior in 10.4 seems to be correct, so there is nothing to fix; but the difference is not critical enough to backport the change to 10.3.

          elenst Elena Stepanova added a comment - The error seems to be correct though, isn't it? ID indeed isn't defined in the function/package, and the statement it's used in doesn't refer to any table. The simplified example is this: CREATE FUNCTION f() RETURNS INT RETURN ID; In 10.4, it throws an error upon function creation: 10.4 edc3899d97 MariaDB [test]> CREATE FUNCTION f() RETURNS INT RETURN ID; ERROR 1054 (42S22): Unknown column 'ID' in 'field list' but in 10.3 it only throws the error upon function call: 10.3 811e4409c MariaDB [test]> CREATE FUNCTION f() RETURNS INT RETURN ID; Query OK, 0 rows affected (0.024 sec)   MariaDB [test]> SELECT f(); ERROR 1054 (42S22): Unknown column 'ID' in 'order clause' The difference was introduced in 10.4.0. We could find what exactly caused it, there was extensive refactoring in parser and around it, but I'm not sure it makes much sense. The behavior in 10.4 seems to be correct, so there is nothing to fix; but the difference is not critical enough to backport the change to 10.3.

          People

            elenst Elena Stepanova
            AlenaS Alena Subotina
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.