Gleb,
As a sidenote - shouldn't MySQL raise an error when data gets
truncated?
MySQL raises a warning after such ALTER operation. See:
mysql create table dt(a decimal(4,1));
Query OK, 0 rows affected (0.01 sec)
mysql insert into dt set a=999.1;
Query OK, 1 row affected (0.00 sec)
In article [EMAIL PROTECTED],
Martijn Tonies [EMAIL PROTECTED] writes:
mysql insert into dt set a=999.1;
Query OK, 1 row affected (0.00 sec)
mysql alter table dt change a a decimal(2,1);
Query OK, 1 row affected, 1 warning (0.02 sec)
Records: 1 Duplicates: 0 Warnings: 1
mysql show
mysql insert into dt set a=999.1;
Query OK, 1 row affected (0.00 sec)
mysql alter table dt change a a decimal(2,1);
Query OK, 1 row affected, 1 warning (0.02 sec)
Records: 1 Duplicates: 0 Warnings: 1
mysql show warnings;
Martijn Tonies wrote:
| Warning | 1264 | Out of range value adjusted for column 'a' at row 1
Could be me ... but isn't this a little too late?
eg: AFTER you have lost your data?
IMO, it should raise an error UNLESS you force it to truncate the data.
This would contradict the MySQL design
As a sidenote - shouldn't MySQL raise an error when data gets
truncated?
MySQL raises a warning after such ALTER operation. See:
mysql create table dt(a decimal(4,1));
Query OK, 0 rows affected (0.01 sec)
mysql insert into dt set a=999.1;
Query OK, 1 row affected (0.00 sec)
mysql
Hello.
If a value doesn't fit (in the domain of tinyint), an exception
should be raised. Plain and simple.
MySQL 5.0 has this ability. Check STRICT_ALL_TABLES and
STRICT_TRANS_TABLES SQL modes at:
http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
CREATE
Hello.
I don't think that it is possible to recover the data from the new
table, because ALTER operation creates a new table and fills it with
data (and truncates the data). But why did the system backup not help
you? Could you describe the situation more in detail. If you haven't
flushed
Gleb,
I don't think that it is possible to recover the data from the new
table, because ALTER operation creates a new table and fills it with
data (and truncates the data). But why did the system backup not help
you? Could you describe the situation more in detail. If you haven't
flushed you
Hello.
As a sidenote - shouldn't MySQL raise an error when data gets truncated?
MySQL raises a warning after such ALTER operation. See:
mysql create table dt(a decimal(4,1));
Query OK, 0 rows affected (0.01 sec)
mysql insert into dt set a=999.1;
Query OK, 1 row affected (0.00 sec)