Bug #36768 partition_info::check_partition_info() reports mal formed warnings
Submitted: 16 May 2008 22:08 Modified: 11 Nov 2008 21:27
Reporter: Marc ALFF Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1 and up OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[16 May 2008 22:08] Marc ALFF
Description:
In partition_info.cc, the method partition_info::check_partition_info()
contains the following code:

        if (part_elem->data_file_name)
          push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
                       "DATA DIRECTORY option ignored");
        if (part_elem->index_file_name)
          push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
                       "INDEX DIRECTORY option ignored");

There are several issues here.

1) calling push_warning with an error code of 0 is wrong.

This warning won't have a proper error code, sqlstate, and can't be
caught by an exception handler.
It will confuse a client application that inspect the result of
SHOW WARNINGS.

2) calling push_warning with a hard coded string is wrong.

The string won't be translated for non english deployments.

How to repeat:
Read the following tests output:

- partition_not_windows.result
- partition_symlink.result

Look for:

Warnings:
Warning 0       DATA DIRECTORY option ignored
Warning 0       INDEX DIRECTORY option ignored

Suggested fix:
When calling push_warning(),
use an error present in sql/share/errmsg.txt, or add a new one if needed.
[17 May 2008 0:42] Marc ALFF
The same problem exists in sql_table.cc, in mysql_create_table_no_lock().

The affected test is r/symlink.result
[17 May 2008 13:43] Sveta Smirnova
Thank you for the report.

Verified as described.
[6 Oct 2008 20:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/55489

2762 Marc Alff	2008-10-06
      Bug#36768 (partition_info::check_partition_info() reports mal formed
      warnings)
      
      Before this fix, several places in the code would raise a warning with an
      error code 0, making it impossible for a stored procedure, a connector,
      or a client application to trigger logic to handle the warning.
      Also, the warning text was hard coded, and therefore not translated.
      
      With this fix, new errors numbers have been created to represent these
      warnings, and the warning text is coded in the errmsg.txt file.
[10 Nov 2008 10:52] Bugs System
Pushed into 6.0.8-alpha  (revid:marc.alff@sun.com-20081006203615-srnz8p6nl2ljm2wl) (version source revid:kgeorge@mysql.com-20081008153732-l6v08qjog3mox311) (pib:5)
[10 Nov 2008 11:37] Bugs System
Pushed into 5.1.30  (revid:marc.alff@sun.com-20081006203615-srnz8p6nl2ljm2wl) (version source revid:kgeorge@mysql.com-20081010130753-obt82wv52av801ed) (pib:5)
[11 Nov 2008 16:04] Paul DuBois
The versions are actually 5.1.31, 6.0.9.
[11 Nov 2008 21:27] Paul DuBois
Noted in 5.1.31, 6.0.9 changelogs.

Partitioned table checking sometimes returned a warning with an error
code of 0, making proper response to errors impossible. The fix also
renders the error message subject to translation in non-English
deployments.
[19 Jan 2009 11:24] Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090108105244-8opp3i85jw0uj5ib) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:02] Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:08] Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)