Bug #113449 SQLColumns returns incorrect value for NULLABLE of datetime columns.
Submitted: 18 Dec 2023 9:29 Modified: 18 Dec 2023 10:00
Reporter: Martin Moleman Email Updates:
Status: Analyzing Impact on me:
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:8.2.0 OS:Windows
Assigned to: MySQL Verification Team CPU Architecture:Any

[18 Dec 2023 9:29] Martin Moleman
I have following table

CREATE TABLE `testdatetimetable` (
  `ID` int NOT NULL DEFAULT '0',
  `TestDate` date NOT NULL DEFAULT '0001-01-01',
  `TestDatetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

SQLColumns returns following:

    COLUMN_NAME         : TestDate
    DATA_TYPE           : 91
    TYPE_NAME           : date
    NULLABLE            : 0
    COLUMN_DEF          : '0001-01-01'

    COLUMN_NAME         : TestDatetime
    DATA_TYPE           : 93
    TYPE_NAME           : datetime
    NULLABLE            : 1
    COLUMN_DEF          : '0001-01-01 00:00:00'

The values for the date column are correct.
But the NULLABLE value for Datetime is wrong. The column does not allow nulls, so nullable should be 0.
All other types return this correct, it is just datetime that is wrong.

This used to work correct in earlier MySQL ODBC versions.
These versions I have tested:
    MySQL ODBC 8.0.29 and earlier  worked correct
    MySQL ODBC 8.0.33   broken
    MySQL ODBC 8.1.0    broken
    MySQL ODBC 8.2.0    broken

How to repeat:
Create the sample table and call SQLColumns