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

New warning messages are unreadable

Details

    Description

      MDEV-6697 introduced a bunch of new warning messages, many of which are totally confusing. No matter how hard I try, I cannot understand what they mean, it's very frustrating.

      create table t1(a int not null primary key, b int, key(b)) engine=innodb;
      alter table t1 add foreign key(a,b) references t1(a);
       
      Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a,b) references t1(a) close to ). Too few referenced columns, you have 1 when you should have 2.

      What close to what? What does the right bracket relate to?
      Error in foreign key? Error in references?

      create table t1(a int not null primary key, b int, key(b)) engine=innodb;
      alter table t1 add foreign key(a) references t1(a,b);
       
      | Warning |  150 | Alter  table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a) references t1(a,b) close to ). Too few referenced columns, you have 2 when you should have 1. |

      How can it be too few if I have more than I should have?

      create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
      ...
      | Warning |  150 | Create  table `tmp`.`t2` with foreign key constraint failed. Referenced table `tmp`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb. |

      Again, what close to what? Data dictionary to foreign keys? Referenced table to foreign keys?
      And I never referenced `tmp`.`t1` – yes, I can guess why it appeared there, but it's still wrong.

      ...

      Attachments

        Activity

          Hi, I see, if you have suggestions on how to make these more readable that would be more than welcomed. Messages like near xxxx, mean that parser has found something unexpected starting on that string, it could be or not be the exactly the correct place where something is wrong.

          jplindst Jan Lindström (Inactive) added a comment - Hi, I see, if you have suggestions on how to make these more readable that would be more than welcomed. Messages like near xxxx, mean that parser has found something unexpected starting on that string, it could be or not be the exactly the correct place where something is wrong.

          Regarding the "close to XXXX" part, why not make it look the same as the old "error in SQL syntax", which people are used to:

          create table t1 (i int) unknown clause;
          You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'unknown clause' at line 1

          It's very similar, the important difference here is that the beginning of the part which could not be parsed is given in quote marks, so it's very clear that it actually quotes the original statement; "near" instead of "close to" is somewhat less important, it's just the matter of fast recognizing of familiar patterns in the message. I vote for "near".

          So, looking at the message

          Alter  table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a,b) references t1(a) close to ). Too few referenced columns, you have 1 when you should have 2.

          First, it says twice "foreign key constraint", there is no need for that. Either

          Alter  table `test`.`t1` failed. Foreign key constraint parse error in ...

          or

          Alter  table `test`.`t1` with foreign key constraint failed. Parse error in ...

          would be more readable.

          Secondly, both quoted "in" and "close to" parts should be in quote marks.

          So, for the first example, if it were

          Alter  table `test`.`t1` with foreign key constraint failed. Parse error in 'foreign key(a,b) references t1(a)' near ')'. Too few referenced columns, you have 1 when you should have 2.

          it would have been much clearer, even though it looks very similar.
          For example, I with all honesty thought that the closing bracket after "close to" was a malformed message, it never occurred to me that it was just quoting the place when parsing went wrong.

          The second message in the description is plain wrong, I suspect copy-paste. "close to" (or "near") should apparently point at the comma, not at the closing bracket, and "you have 2 when you should have 1" should be backwards.

          The third message is still weird.

          Create  table `tmp`.`t2` with foreign key constraint failed. Referenced table `tmp`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb.

          I still don't like it that it claims that `tmp`.`t1` was referenced; and the "close to" part also points at the wrong place, it should be "close to 't1(a)'"; or, if you can't point at the exact place here, it should be "in 'foreign key(a) references t1(a))'", without the "close to" part.

          elenst Elena Stepanova added a comment - Regarding the "close to XXXX" part, why not make it look the same as the old "error in SQL syntax", which people are used to: create table t1 (i int) unknown clause; You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'unknown clause' at line 1 It's very similar, the important difference here is that the beginning of the part which could not be parsed is given in quote marks, so it's very clear that it actually quotes the original statement; "near" instead of "close to" is somewhat less important, it's just the matter of fast recognizing of familiar patterns in the message. I vote for "near". So, looking at the message Alter table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a,b) references t1(a) close to ). Too few referenced columns, you have 1 when you should have 2. First, it says twice "foreign key constraint", there is no need for that. Either Alter table `test`.`t1` failed. Foreign key constraint parse error in ... or Alter table `test`.`t1` with foreign key constraint failed. Parse error in ... would be more readable. Secondly, both quoted "in" and "close to" parts should be in quote marks. So, for the first example, if it were Alter table `test`.`t1` with foreign key constraint failed. Parse error in 'foreign key(a,b) references t1(a)' near ')'. Too few referenced columns, you have 1 when you should have 2. it would have been much clearer, even though it looks very similar. For example, I with all honesty thought that the closing bracket after "close to" was a malformed message, it never occurred to me that it was just quoting the place when parsing went wrong. The second message in the description is plain wrong, I suspect copy-paste. "close to" (or "near") should apparently point at the comma, not at the closing bracket, and "you have 2 when you should have 1" should be backwards. The third message is still weird. Create table `tmp`.`t2` with foreign key constraint failed. Referenced table `tmp`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb. I still don't like it that it claims that `tmp`.`t1` was referenced; and the "close to" part also points at the wrong place, it should be "close to 't1(a)'"; or, if you can't point at the exact place here, it should be "in 'foreign key(a) references t1(a))'", without the "close to" part.

          Please note that MDEV-8855 appears to be more important than this one.

          elenst Elena Stepanova added a comment - Please note that MDEV-8855 appears to be more important than this one.

          commit 5d754fce95fa378027d1b575d049ab6b78823bb7
          Author: Jan Lindström <jan.lindstrom@mariadb.com>
          Date: Mon Nov 9 09:23:32 2015 +0200

          MDEV-8854: New warning messages are unreadable

          Improved warning messages by quote marks.

          jplindst Jan Lindström (Inactive) added a comment - commit 5d754fce95fa378027d1b575d049ab6b78823bb7 Author: Jan Lindström <jan.lindstrom@mariadb.com> Date: Mon Nov 9 09:23:32 2015 +0200 MDEV-8854 : New warning messages are unreadable Improved warning messages by quote marks.

          People

            jplindst Jan Lindström (Inactive)
            elenst Elena Stepanova
            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.