Bug #113449 SQLColumns returns incorrect value for NULLABLE of datetime columns.
Submitted: 18 Dec 2023 9:29 Modified: 5 Jun 13:08
Reporter: Martin Moleman Email Updates:
Status: Analyzing Impact on me:
None 
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
Description:
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',
  PRIMARY KEY (`ID`)
) 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
[15 May 11:46] MySQL Verification Team
Hello Martin Moleman,

Thank you for the bug report.
Could you please upgrade to latest version and report us back if issue persist even in latest version along with test case? Thank you.

Regards,
Ashwini Patil
[4 Jun 8:59] Martin Moleman
Just tried this with mysql-connector-odbc-9.3.0 and the problem still exists with this version.

Martin
[4 Jun 12:04] MySQL Verification Team
Hello Martin,

Thank you for the feedback.
Could you please provide repeatable test case to reproduce this issue at our end?

Regards,
Ashwini Patil