On Jan 7, 2008, at 12:18 PM, Dave Howorth wrote:

> Pedro Melo wrote:
>> Attached, second version of the patch, based on feedback from  
>> Darren and
>> Dave.
>
> Thanks Pedro.
>
> Ash sent me a PM ...

Opps yes. I keep forgetting this list doesn't set the reply to  
headers ;)

Reproduced for the list below:

My vote is to go for changing default behaviour since ENUM('0', '1')  
has the following undesirable behaviour:

mysql> use test;
Database changed
mysql> create table btable (bool_col ENUM('0','1'));
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO btable VALUES (0), (1), ('0'), ('1');
Query OK, 4 rows affected, 1 warning (0.02 sec)
Records: 4  Duplicates: 0  Warnings: 1

mysql> show warnings;
+---------+------+-----------------------------------------------+
| Level   | Code | Message                                       |
+---------+------+-----------------------------------------------+
| Warning | 1265 | Data truncated for column 'bool_col' at row 1 |
+---------+------+-----------------------------------------------+
1 row in set (0.00 sec)

mysql> select bool_col,bool_col+0,bool_col=1,bool_col='1' from btable;
+----------+------------+------------+--------------+
| bool_col | bool_col+1 | bool_col=1 | bool_col='1' |
+----------+------------+------------+--------------+
|          |          0 |          0 |            0 |
| 0        |          1 |          1 |            0 |
| 0        |          1 |          1 |            0 |
| 1        |          2 |          0 |            1 |
+----------+------------+------------+--------------+
4 rows in set (0.02 sec)

bool_col=1 === bool_col = '0' (since '0' is hte first item in the enum)

Also both of you  are advocating keeping the behaviour the same, but  
is there anyone that actually uses and wants the current behaviour? I  
personally don't use BOOLEAN as column types for SQLT for the above  
reason.


Ash

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-- 
sqlfairy-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlfairy-developers

Reply via email to