Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-563

Incorrect handling of max_column size sent by server to client in Column definition packet

    XMLWordPrintable

    Details

      Description

      Running the following MTR test case

      CREATE TABLE t1(f1 YEAR(4));
      INSERT INTO t1 VALUES (0000),(2001);
      --enable_metadata
      (SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
      --disable_metadata
      DROP TABLE t1;
      

      leads to test failure in case it is run with the option --ps-protocol with the following diagnostic message:

      @@ -2,7 +2,7 @@
       INSERT INTO t1 VALUES (0000),(2001);
       (SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
       Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
      -def				MAX(f1)	MAX(f1)	13	4	4	Y	32864	0	63
      +def				MAX(f1)	MAX(f1)	13	4	6	Y	32864	0	63
       MAX(f1)
       2001
       DROP TABLE t1;
       
      mysqltest: Result content mismatch
      

      Running above mentioned test under debugger shows that resultset metadata in Server Response packet is set correctly.

      Discussion of this issue with Georg discovered surprising thing - Max column size sent in Response packet is ignored and actual value is calculated based on constants initialized in the function mysql_init_ps_subsystem().

      It seems such implementation is good candidate for rewriting.

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            shulga Dmitry Shulga
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration