| Bug #695 | ambiguous definition of timestamp field status | ||
|---|---|---|---|
| Submitted: | 21 Jun 2003 23:08 | Modified: | 14 Jul 2003 1:17 | 
| Reporter: | paladin | Email Updates: | |
| Status: | Won't fix | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) | 
| Version: | 3.23.49 | OS: | Windows (windows) | 
| Assigned to: | Jani Tolonen | CPU Architecture: | Any | 
   [12 Jul 2003 9:51]
   Paul DuBois        
  This isn't really a bug. A similar thing happens if you create an AUTO_INCREMENT column. (That is, SHOW COLUMNS will show the Default value as NULL, even though the column cannot actually contain NULL.) The meaning is that to get the default value for a TIMESTAMP or AUTO_INCREMENT column, you assign NULL to it, and MySQL sets the column value automatically. In any case, how could SHOW COLUMNS display a different Default value for such columns? The default is not the same for every row; there is no other value that it makes sense for SHOW COLUMNS to display.
   [12 Jul 2003 11:23]
   paladin         
  thankyou, Paul. I agree with your logic, but nevertheless am stuck with trying to find a way around this in Delphi. Is it possible to modify what the fetch call returns without recompiling all the sources? tia!
   [14 Jul 2003 1:17]
   Sergei Golubchik        
  Unfortunately not. And we cannot change it in the next release either - it will create HUGE problems for ODBC users. E.g. one no longer will be able to make TIMESTAMP a part of PRIMARY or UNIQUE key. NOT_NULL_FLAG only means that one doesn't have to expect to *get* NULL from this column. The fact that dbExpress doesn't allow to *store* NULL there should be considered a dbExpress bug - you can submit a bugreport to Borland about it. Meanwhile, you can use NOW() to set TIMESTAMP to current time.
   [14 Jul 2003 5:43]
   paladin         
  brilliant. thanks, serg!


Description: hello all! I am using MySQL (3.23.49) along with Borland's Delphi 7 When delphi opens a table with a timestamp field, it immediately marks that field NotNull, due to mysql_fetch_field (we think) including the NOT_NULL_FLAG in its return value. This is bad, since the delphi dbExpress driver software rigidly enforces the NotNull and I can't send a null value to get a local, server timezone specific timestamp. We think that since sending a Null to a timestamp field is legal, this API call (mysql_fetch_field ) should not be returning NOT_NULL_FLAG. In fact, if you say "create table test ( somestamp timestamp null )", it will cheerfully create a NULL-able field. And show columns will also indicate NULL-able. Paradoxically, "show create table" will produce script to make a NOT NULL field. Probably it uses mysql_fetch_field as well. Anyway, my questions are: -does any one else think this is a bug? that maybe MySQL should fix? -is there any [easy] way for me to alter the return value to appease delphi? thanks for any consideration! How to repeat: create a table with a timestamp field compare the outputs of: -show create table vs. -show columns (or describe)