List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 22 1999 3:10pm
Subject:Re: BUG ? Auto_increment and tiny_int
View as plain text  
At 4:50 PM +0200 9/22/99, Martin Ramsch wrote:
>On Wed, 1999-09-22 06:42:14 -0700, Rick Moore wrote:
>>  id tinyint unsigned not null auto_increment );
>[...]
>>  show columns from test2;
>>  +-------+---------------------+------+-----+---------+----------------+...
>>  | Field | Type                | Null | Key | Default | Extra          |...
>>  +-------+---------------------+------+-----+---------+----------------+...
>>  | id    | tinyint(3) unsigned |      | PRI | NULL    | auto_increment |...
>>  +-------+---------------------+------+-----+---------+----------------+...
>>  1 row in set (0.00 sec)
>>
>>  I thought I specified "not null?"  I haven't researched the manual
>>  thoroughly, but I assume this is an intentional silent column
>>  change...
>
>No, it's no column changes, because the "NOT NULL" of the column
>definition is reflected in the 'Null' column above: being empty means,
>no NULL values.
>
>But NULL as default values is--as I've recently learned here on the
>list--to make ODBC happy and have it really insert NULL into
>AUTO_INCREMENT columns.  Otherwise you wouldn't get the automatic
>increments ...
>(Hope, I got that explanation right ...)

Close enough!

It's like TIMESTAMP, for which the same information is reported.
What it really indicates is that you are allowed to store a NULL
into either type of column (which is true), not that the column
will actually have NULL values stored in it.

I usually have to think about this a bit each time I see it, but
having SHOW COLUMNS/DESCRIBE report NOT NULL would have a similar
problem.  Just in reverse. :-)

-- 
Paul DuBois, paul@stripped
Thread
BUG ? Auto_increment and tiny_intPeter Zaitsev21 Sep
  • Re: BUG ? Auto_increment and tiny_intScott Hess21 Sep
    • Re: BUG ? Auto_increment and tiny_intMichael Widenius22 Sep
  • Re: BUG ? Auto_increment and tiny_intRick Moore22 Sep
    • Re: BUG ? Auto_increment and tiny_intMartin Ramsch22 Sep
      • Re: BUG ? Auto_increment and tiny_intPaul DuBois22 Sep
    • Re: BUG ? Auto_increment and tiny_intMichael Widenius22 Sep