Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-258

raise ValueError for INTEGER ZEROFILL column

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.6
    • 1.1.7
    • Generic
    • None
    • MariaDB 10.11
    • 3.9

    Description

      I've observed that when I create a table with an INTEGER ZEROFILL column, MariaDB Connector/Python raises ValueError getting results. However, MySQL Connector/Python seems working well and returns `23987` in the provided test case.

      The test case:

      def execute_and_print(con, sql):
          try:
              cursor = con.cursor()
              cursor.execute(sql)
              column_type = [m[1] for m in cursor.description]
              print('column type', *column_type, sep=' * ')
              for row in cursor:
                  print(*row, sep=' * ')
              cursor.close()
          except Exception as e:
              raise e
       
      def execute(con, sql):
          try:
              cursor = con.cursor()
              cursor.execute(sql)
              cursor.close()
          except Exception as e:
              raise e
       
      conn_params = {
          "user": "root",
          "password": "password",
          "host": "127.0.0.1"
      }
       
      con = mariadb.connect(**conn_params)
      execute(con, "DROP DATABASE IF EXISTS test")
      execute(con, "CREATE DATABASE test")
      execute(con, "USE test")
      execute(con, "CREATE TABLE IF NOT EXISTS t0(c0 INTEGER ZEROFILL)")
      execute(con, "INSERT INTO t0 VALUES(23987)")
      execute_and_print(con, "SELECT * FROM t0")
      con.close()
      

      Attachments

        Activity

          dwenking chaos created issue -
          dwenking chaos made changes -
          Field Original Value New Value
          Description I've observed that when I create a table with an INTEGER ZEROFILL column, MariaDB Connector/Python raises ValueError getting results. However, MySQL Connector/Python seems working well and returns `23987` in the provided test case.

          The test case:
          {code:python}
          def execute(con, sql):
              try:
                  cursor = con.cursor()
                  cursor.execute(sql)
                  cursor.close()
              except Exception as e:
                  print(e)

          conn_params = {
              "user": "root",
              "password": "password",
              "host": "127.0.0.1"
          }

          con = mariadb.connect(**conn_params)
          execute(con, "DROP DATABASE IF EXISTS test")
          execute(con, "CREATE DATABASE test")
          execute(con, "USE test")
          execute(con, "CREATE TABLE IF NOT EXISTS t0(c0 INTEGER ZEROFILL)")
          execute(con, "INSERT INTO t0 VALUES(23987)")
          execute_and_print(con, "SELECT * FROM t0")
          con.close()
          {code}

          I've observed that when I create a table with an INTEGER ZEROFILL column, MariaDB Connector/Python raises ValueError getting results. However, MySQL Connector/Python seems working well and returns `23987` in the provided test case.

          The test case:
          {code:python}
          def execute_and_print(con, sql):
              try:
                  cursor = con.cursor()
                  cursor.execute(sql)
                  column_type = [m[1] for m in cursor.description]
                  print('column type', *column_type, sep=' * ')
                  for row in cursor:
                      print(*row, sep=' * ')
                  cursor.close()
              except Exception as e:
                  raise e

          def execute(con, sql):
              try:
                  cursor = con.cursor()
                  cursor.execute(sql)
                  cursor.close()
              except Exception as e:
                  raise e

          conn_params = {
              "user": "root",
              "password": "password",
              "host": "127.0.0.1"
          }

          con = mariadb.connect(**conn_params)
          execute(con, "DROP DATABASE IF EXISTS test")
          execute(con, "CREATE DATABASE test")
          execute(con, "USE test")
          execute(con, "CREATE TABLE IF NOT EXISTS t0(c0 INTEGER ZEROFILL)")
          execute(con, "INSERT INTO t0 VALUES(23987)")
          execute_and_print(con, "SELECT * FROM t0")
          con.close()
          {code}
          georg Georg Richter made changes -
          Component/s Generic [ 14515 ]
          Fix Version/s 1.1.7 [ 28707 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]

          People

            georg Georg Richter
            dwenking chaos
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.