List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:March 28 2008 9:47pm
Subject:Re: [OT] When MySQL Bites: Quirks to Watch Out For
View as plain text  
>i'm not trying to make trouble or bother someone with this
>information

Misinformation---the first five items I found in this article make false 
claims:

1.
CREATE TABLE creature (name VARCHAR(3) NOT NULL);
INSERT INTO creature SET name = 'caterpillar';
Query OK, 1 row affected, 1 warning (0.00 sec)
SHOW WARNINGS;
+---------+------+-------------------------------------------+
| Level   | Code | Message                                   |
+---------+------+-------------------------------------------+
| Warning | 1265 | Data truncated for column 'name' at row 1 |
+---------+------+-------------------------------------------+

2.
CREATE TABLE exam (mark TINYINT(2) NOT NULL);
INSERT INTO exam SET mark = 172;
Query OK, 1 row affected, 1 warning (0.00 sec)
SELECT * FROM exam;
+------+
| mark |
+------+
|  127 |
+------+
SHOW WARNINGS;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1264 | Out of range value adjusted for column 'mark' at row 1 |
+---------+------+--------------------------------------------------------+

3.
CREATE TABLE game (shape ENUM('scissors', 'paper', 'stone') NOT NULL);
INSERT INTO game SET shape = 'rock';
Query OK, 1 row affected, 1 warning (0.01 sec)
+---------+------+--------------------------------------------+
| Level   | Code | Message                                    |
+---------+------+--------------------------------------------+
| Warning | 1265 | Data truncated for column 'shape' at row 1 |
+---------+------+--------------------------------------------+

4.
 >Putting this into ~/.my.cnf:

 >    [client]
 >    show-warnings

 >makes it less tedious to see the warnings

show-warnings is _not_ necessary for warning display.

5.
 > SQL modes are per-connection, so somebody could simply turn off 
strict mode:

Wrong. sql_mode is global _or_ per-connection.

--------------------------------------------------

PB

obed wrote:
> Hi all, i'm not trying to make trouble or bother someone with this
> information, I'm a mysql user and I love it, I just wanna know your
> point of view about it.
>
> http://use.perl.org/~Smylers/journal/34246
>
> Have good one.
>
>   
Thread
[OT] When MySQL Bites: Quirks to Watch Out Forobed28 Mar
  • Re: [OT] When MySQL Bites: Quirks to Watch Out ForPeter Brawley28 Mar
    • Re: [OT] When MySQL Bites: Quirks to Watch Out ForArthur Fuller29 Mar
      • Re: [OT] When MySQL Bites: Quirks to Watch Out ForOfer Inbar29 Mar
        • Re: [OT] When MySQL Bites: Quirks to Watch Out Forpaul rivers29 Mar
  • Re: [OT] When MySQL Bites: Quirks to Watch Out ForBaron Schwartz29 Mar