logo       

Re: Create Table Bug w/Varchar and Char: msg#01101

db.mysql.general

Subject: Re: Create Table Bug w/Varchar and Char

http://www.mysql.com/doc/S/i/Silent_column_changes.html
6.5.3.1 Silent Column Specification Changes

In some cases, MySQL silently changes a column specification from that given in a CREATE TABLE statement. (This may also occur with ALTER TABLE.)
:

* VARCHAR columns with a length less than four are changed to CHAR.

On Friday, June 28, 2002, at 01:00 PM, Don Vu wrote:

I'm seeing some freaky behavior from MySQL. Seems as if the column type in my CREATE TABLE script isn't being created...i.e. some of the VARCHARs become CHARs?!?!

fyi...i'm running MySQL 3.23.37 on Red Hat Linux...

When I try to do this Create Table script:

Create table MemberSummary2 (
memberId Varchar(20) NOT NULL ,
firstName Varchar(50) ,
lastName Varchar(50) ,
gender Varchar(1) ,
email Varchar(50) ,
homePhone Varchar(20) ,
address1 Varchar(50) ,
address2 Varchar(50) ,
city Varchar(20) ,
state Varchar(2) ,
zip Varchar(5) ,
ageGroup Varchar(20) ,
birthday Date NULL,
moviePref Varchar(50),
2ndFirstName Varchar(50) ,
2ndLastName Varchar(50) ,
2ndGender Varchar(1) ,
2ndBirthday Date NULL,
planTypeId Integer(11) ,
purchaseDate Date NULL,
purchaseAmt Float(4,2) ,
charterFlag Varchar(1) ,
paymentType Varchar(20) ,
giftRecd Varchar(1) ,
tempCard Varchar(1) ,
inputInit Varchar(3) ,
http_date Varchar(20),
http_time Time ,
sentEmail Varchar(1) ,
Primary Key (memberId)
);

I get this:

mysql> source test.sql
Query OK, 0 rows affected (0.00 sec)

mysql> desc MemberSummary2;
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| memberId | varchar(20) | | PRI | | |
| firstName | varchar(50) | YES | | NULL | |
| lastName | varchar(50) | YES | | NULL | |
| gender | char(1) | YES | | NULL | |
| email | varchar(50) | YES | | NULL | |
| homePhone | varchar(20) | YES | | NULL | |
| address1 | varchar(50) | YES | | NULL | |
| address2 | varchar(50) | YES | | NULL | |
| city | varchar(20) | YES | | NULL | |
| state | char(2) | YES | | NULL | |
| zip | varchar(5) | YES | | NULL | |
| ageGroup | varchar(20) | YES | | NULL | |
| birthday | date | YES | | NULL | |
| moviePref | varchar(50) | YES | | NULL | |
| 2ndFirstName | varchar(50) | YES | | NULL | |
| 2ndLastName | varchar(50) | YES | | NULL | |
| 2ndGender | char(1) | YES | | NULL | |
| 2ndBirthday | date | YES | | NULL | |
| planTypeId | int(11) | YES | | NULL | |
| purchaseDate | date | YES | | NULL | |
| purchaseAmt | float(4,2) | YES | | NULL | |
| charterFlag | char(1) | YES | | NULL | |
| paymentType | varchar(20) | YES | | NULL | |
| giftRecd | char(1) | YES | | NULL | |
| tempCard | char(1) | YES | | NULL | |
| inputInit | char(3) | YES | | NULL | |
| http_date | varchar(20) | YES | | NULL | |
| http_time | time | YES | | NULL | |
| sentEmail | char(1) | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
29 rows in set (0.00 sec)

How does the Gender, State, etc. go from Varchar to Char?

any insight appreciated...

-Don



---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <mysql-thread113342@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-david=ark.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



David Felio
Software Developer
Information Network of Arkansas
http://www.AccessArkansas.org


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <mysql-thread113350@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail
<mysql-unsubscribe-gcdmg-mysql=m.gmane.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise