[MDEV-7843] Second an subsequent SQL Server datetime columns of a CONNECT table have invalid default value of '0000-00-00 00:00:00' Created: 2015-03-26 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.0.17, 10.3, 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Tuco | Assignee: | Andrew Hutchings |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7/ Windows Server 2008R2, MS SQL Server 2012 |
||
| Description |
|
[NOTE] This might be related to issue MDEV-7842 When creating CONNECT table using auto column discovery. Second and subsequent SQL Server datetime columns will be created with an invalid default value of '0000-00-00 00:00:00'.
The source table on SQL Server is created as follows
This did not affect 10.0.15 as that version used the type of datetime instead of timestamp for these columns
As CONNECT tables are just an interface to an actual remote table. It might be better to not automatically specify any columns NOT NULLable, and instead allow the remote table to enforce the check. |
| Comments |
| Comment by Olivier Bertrand [ 2015-04-01 ] | ||||||||||||||||||||||||||||||||||
|
Hummm... they are apparently several issues concerning this.
Here for the date columns the return type is 11 that is defined in sqlext.h as SQL_TIMESTAMP. Other data sources return 11 for DATETIME and some others correctly return 9. In the case above, after executing:
this statement is:
As explained above, the date columns are defined as TIMESTAMP but this statement does not say anything about their default values. What happens after that occurs inside the init_from_sql_statement_string function and is no more CONNECT business. Indeed:
returns:
The additional question about specifying all columns as not null seems reasonable but will not solve the problem of MariaDB adding default values in init_from_sql_statement_string. | ||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-01-22 ] | ||||||||||||||||||||||||||||||||||
|
Updating versions under assumption that it hasn't been fixed. |