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

COM_STMT_PREPARE Column Definition returns incorrect column type.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.3.9
    • 10.4
    • Prepared Statements
    • None
    • 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

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

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.