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

COM_STMT_PREPARE Column Definition returns incorrect column type.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3.9
    • Fix Version/s: 10.3
    • Component/s: Prepared Statements
    • Labels:
      None
    • Environment:
      Official docker image: library:mariadb:10.3.9, with all settings/confs left at default.

      Description

      I am not using any library to access mariadb, I am just using the protocol directly as described here.

      The issue is when creating a prepared statement (using the binary protocol).
      COM_STMT_PREPARE_OK returns the wrong column type in the column description packet.

      This only happens with mariadb 10.3.x. It works fine with 10.2.x and prior versions.

      Details:

      Table:

      CREATE TEMPORARY TABLE test (
        id             serial    PRIMARY KEY,
        name           text      NOT NULL
      );
      

      Prepared statement:

      INSERT INTO test (name) VALUES (?)
      

      Protocol calls:

      > <COM_STMT_PREPARE>
      >  INSERT INTO test (name) VALUES (?)
       
      < <COM_STMT_PREPARE_OK>
      <  column count: 0
      <  parameter count: 1
      <  <COLUMN_DEFINITION>
      <  schema: ""
      <  table alias: ""
      <  table: ""
      <  column alias: "?"
      <  column: ""
      <  collation: 63
      <  max column size: 0
      <  column type: *0x06 = NULL instead of 0xfd = VARSTRING*
      <  binary: true
      <  decimals: 0
      < <EOF>
      

      There's only one column definition sent, since there's only one param in the statement.
      The column definition now returns a column type of 0x06 (NULL).
      With all previous versions (10.2.x and earlier), it returns 0xfd (VARSTRING), which is correct, it's the type of the name column.

        Attachments

          Activity

            People

            • Assignee:
              bar Alexander Barkov
              Reporter:
              programingjd Jerome David
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: