Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-162

SQLNumResultCols returns zero for query with long data and CTE

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 3.0.5
    • 2.0.17, 3.0.6
    • General
    • None

    Description

      Driver somehow returns 0 colmns for this query. Same query works correctly with MySQL 8.0/MySQL ODBC Connector 8.0

      with x as (
          select 1 as `val`
          union all
          select 2 as `val`
          union all
          select 3 as `val`
      )
      select repeat(cast(x.val as nchar), x.val * 12000) as `string`
           , repeat(cast(x.val as char), x.val * 12000) as `c_string`
           , cast(repeat(char(x.val), x.val * 12000) as binary) as `binary`
           , x.val as `index`
      from x;
      

      Relevant part of the trace log:

      [ODBC][459][1531695923.138711][SQLExecDirectW.c][177]
      		Entry:
      			Statement = 0x7f4e0a6d9700
      			SQL = [
                          with x as (
                              select 1 as `val`
                              union all
                         ...][length = 594]
      [ODBC][459][1531695923.140973][SQLExecDirectW.c][445]
      		Exit:[SQL_SUCCESS]
      [ODBC][459][1531695923.140991][SQLNumResultCols.c][156]
      		Entry:
      			Statement = 0x7f4e0a6d9700
      			Column Count = 0x7f4e0a5fa5d4
      [ODBC][459][1531695923.140999][SQLNumResultCols.c][251]
      		Exit:[SQL_SUCCESS]
      			Count = 0x7f4e0a5fa5d4 -> 0
      

      Attachments

        Activity

          nazarmx Nazar Mishturak created issue -
          nazarmx Nazar Mishturak made changes -
          Field Original Value New Value
          Description Driver somehow returns 0 colmns for this query. Same query works correctly with MySQL 8.0/MySQL ODBC Connector 8.0

          {code:sql}
          with x as (
              select 1 as `val`
              union all
              select 2 as `val`
              union all
              select 3 as `val`
          )
          select repeat(cast(x.val as nchar), x.val * 12000) as `string`
               , repeat(cast(x.val as char), x.val * 12000) as `c_string`
               , cast(repeat(char(x.val), x.val * 12000) as binary) as `binary`
               , x.val as `index`
          from x;
          {code}


          [ODBC][459][1531695923.140991][SQLNumResultCols.c][156]
          Entry:
          Statement = 0x7f4e0a6d9700
          Column Count = 0x7f4e0a5fa5d4
          [ODBC][459][1531695923.140999][SQLNumResultCols.c][251]
          Exit:[SQL_SUCCESS]
          Count = 0x7f4e0a5fa5d4 -> 0
          Driver somehow returns 0 colmns for this query. Same query works correctly with MySQL 8.0/MySQL ODBC Connector 8.0

          {code:sql}
          with x as (
              select 1 as `val`
              union all
              select 2 as `val`
              union all
              select 3 as `val`
          )
          select repeat(cast(x.val as nchar), x.val * 12000) as `string`
               , repeat(cast(x.val as char), x.val * 12000) as `c_string`
               , cast(repeat(char(x.val), x.val * 12000) as binary) as `binary`
               , x.val as `index`
          from x;
          {code}

          Relevant part of the trace log:

          {code}
          [ODBC][459][1531695923.138711][SQLExecDirectW.c][177]
          Entry:
          Statement = 0x7f4e0a6d9700
          SQL = [
                              with x as (
                                  select 1 as `val`
                                  union all
                             ...][length = 594]
          [ODBC][459][1531695923.140973][SQLExecDirectW.c][445]
          Exit:[SQL_SUCCESS]
          [ODBC][459][1531695923.140991][SQLNumResultCols.c][156]
          Entry:
          Statement = 0x7f4e0a6d9700
          Column Count = 0x7f4e0a5fa5d4
          [ODBC][459][1531695923.140999][SQLNumResultCols.c][251]
          Exit:[SQL_SUCCESS]
          Count = 0x7f4e0a5fa5d4 -> 0
          {code}
          ralf.gebhardt Ralf Gebhardt made changes -
          Priority Major [ 3 ] Critical [ 2 ]

          Thank you for your bug report.
          The fix and the testcase have been pushed to odbc-3.0 and master as f0cd063
          and are yet to be merged into odbc-2.0
          The problem was that connector misinterpreted type of the WITH statement

          Lawrin Lawrin Novitsky added a comment - Thank you for your bug report. The fix and the testcase have been pushed to odbc-3.0 and master as f0cd063 and are yet to be merged into odbc-2.0 The problem was that connector misinterpreted type of the WITH statement
          Lawrin Lawrin Novitsky made changes -
          issue.field.resolutiondate 2018-07-17 12:39:23.0 2018-07-17 12:39:23.754
          Lawrin Lawrin Novitsky made changes -
          Component/s General [ 14302 ]
          Fix Version/s 3.0.6 [ 23133 ]
          Fix Version/s 2.0.17 [ 23002 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 88429 ] MariaDB v4 [ 135476 ]

          People

            Lawrin Lawrin Novitsky
            nazarmx Nazar Mishturak
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.