Hi.
It's kind of counter-intuitive to me as well, but the rationale is that
there obviously was an error if you have a "" value for an ENUM column. this
theoretically allows you at some later time to use that indicator to do some
sort of error-check or update/delete all erroneous rows, or whatever you
decide to do.
...in other words, it's a feature, not a bug.
-ravi.
-----Original Message-----
From: Bill Marrs [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 12:48 PM
To: [EMAIL PROTECTED]
Subject: RE: Second Request - Limit Filed Input
At 11:22 AM 3/20/2001 -0500, Ravi Raman wrote:
>You can use an ENUM column type assuming the numerical range is less than
>65535 numbers.
>
>http://www.mysql.com/doc/E/N/ENUM.html
One problem I've seen with enums is that I end up with a blank ('') field
if I try to insert a row with a value in the enum column that doesn't fit.
Is there a way to get the insert to fail on "bad input" instead?
For example:
mysql> CREATE TABLE Stats (
-> Status enum('good','bad') NOT NULL
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO Stats VALUES ('neither');
Query OK, 1 row affected (0.00 sec)
(Can I get this insert to FAIL instead? because...)
mysql> select * FROM Stats;
+--------+
| Status |
+--------+
| |
+--------+
1 row in set (0.01 sec)
(this isn't always a good thing).
-bill
---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php