开发者

Strict data validation with MySQL

I am working with MySQL Workbench and I noticed that my table was accepting pretty much any values without doing any data validation. Setting the sql_mode to "STRICT_ALL_TABLES" solved most of my problems.

However, when I insert 开发者_开发问答a floating point value in a integer column, the value is rounded to the nearest int.

My question is: is there a way to force MySQL Workbench to throw an error instead of doing a rounding operation?

Thanks!


It is a design dilemma between being friendly and doing what you mean, or being a pain-in-the-a@@ and making you work harder.

If such validation is valuable, add a frontend interface which performs those sorts of validations, including cross-field and cross-table validation. While you're at it, helpfully suggest field values from correlation with historical values, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜