Hi
On Thu 13. 10. 2005 17:41, Kevin A. McGrail wrote:
I recently edited a table for a column change on an
enum.
The column is not null with a default set and '' is not a member of
the enum.
This is the output from PHPMyadmin where I changed 'Artist' to 'Music
Artist'
Table contact_types has been altered.
SQL query:
ALTER TABLE `contact_types` CHANGE `contact_type` `contact_type`
ENUM( 'Actor', 'Actress', 'Music Artist', 'Band',
'Company',
'Unknown' ) NOT NULL DEFAULT 'Unknown'
[ Edit ] [ Create PHP Code ]
This resulted in all the existing rows that had the value 'Artist'
changing to ''. First, I guess I expected that it would change those
rows to Music Artist but that's my own fault. Second, the fact that
it didn't utilize my default definition ended up "better" than if it
had change it to 'Unknown'
However, running this from the command line results in the following
output:
Query OK, 1578 rows affected, 21 warnings (0.06 sec)
Records: 1578 Duplicates: 0 Warnings: 21
mysql> show warnings;
+---------+------+---------------------------------------------------
---+
| Level | Code | Message |
+---------+------+---------------------------------------------------
---+
| Warning | 1265 | Data truncated for column 'contact_type' at row 9
| |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row 11
| |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row 39
| |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 529 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1533 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1534 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1535 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1536 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1537 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1538 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1539 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1540 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1541 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1542 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1547 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1558 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1568 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1569 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1574 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1575 |
|
| Warning | 1265 | Data truncated for column 'contact_type' at row
| 1576 |
+---------+------+---------------------------------------------------
---+
21 rows in set (0.00 sec)
I believe that the existence of warnings is important and warrants a
change in PHPMyAdmin.
Thoughts?
File feature request for handling MySQL warnings.
--
Michal Čihař |
http://cihar.com