At 8:49 AM -0500 5/26/99, kai@stripped wrote:
>>Description:
>The output of a
> show columns from TABLE
>command has problems with CHAR and VARCHAR columns. The script in the next
>section produces the following output:
>
>Field Type Null Key Default Extra
>Code varchar(8) YES NULL
>Bank varchar(40) YES NULL
>Method char(2) YES NULL
>Name varchar(40) YES NULL
>
>Each VARCHAR column was created as a CHAR column, and the CHAR column was
>created as a VARCHAR column.
>
>>How-To-Repeat:
>Execute the following script:
>
>#!/bin/bash
>set +x
>
>mysql -u root <<EOF
>
>drop database if exists bug;
>create database bug;
>use bug;
>
>create table Tab1 (
> Code CHAR(8),
> Bank CHAR(40),
> Method VARCHAR(2),
> Name CHAR(40)
>);
>
>show columns from Tab1;
>EOF
>
>>Fix:
> ???
MySQL silently changes CHAR(N) to VARCHAR(N) for N>=4 if you have any VARCHAR
columns since by including such columns in your table, the records become
variable-length anyway.
Reference:
http://www.mysql.com/Manual_chapter/manual_Reference.html#Silent_column_changes
--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/