[CONPY-258] raise ValueError for INTEGER ZEROFILL column Created: 2023-04-06  Updated: 2023-04-11  Resolved: 2023-04-11

Status: Closed
Project: MariaDB Connector/Python
Component/s: Generic
Affects Version/s: 1.1.6
Fix Version/s: 1.1.7

Type: Bug Priority: Major
Reporter: Wenqian Deng Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

MariaDB 10.11


Python Version: 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()


Generated at Thu Feb 08 03:31:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.