Re: [Maria-discuss] Reading a field's default value from a trigger
For anyone encountering the "Field 'xxx' doesn't have a default value" when running insert/update/replace statement on MariaDB, I found that this is actually caused by the sql mode STRICT_TRANS_TABLES. This also fixes when a trigger updates the default value of the field. I believe the default options for MariaDB windows installer cause this option to be enabled, whereas I had previous never designed my application for the various modes supported. You can also fix the issue by giving every field in the table an explicit default value of 0 or '' except for text/longtext columns. I choose not to do that since I don't know how many other things change with STRICT_TRANS_TABLES. If you change my.ini / my.cnf to sql-mode="", you won't have this error occur anymore. You can run SELECT @@GLOBAL.sql_mode; on your mysql server and mariadb server to compare what the current settings are. This is my first post to the MariaDB mailing list. Sorry if I did it wrong. I've been using MySQL for over 10 years and decided to migrate to MariaDB now. -- Bruce Kirkpatrick<http://www.skyflare.com/> 386-405-4643
From: maria-discuss-bounces+wlad=montyprogram.com@lists.launchpad.net [mailto:maria-discuss-bounces+wlad=montyprogram.com@lists.launchpad.net] On Behalf Of Bruce Kirkpatrick Sent: Montag, 4. Februar 2013 20:32 To: maria-discuss@lists.launchpad.net Subject: Re: [Maria-discuss] Reading a field's default value from a trigger
For anyone encountering the "Field 'xxx' doesn't have a default value" when running insert/update/replace statement on MariaDB, I found that this is actually caused by the sql mode STRICT_TRANS_TABLES. This also fixes when a trigger updates the default value of the field. I believe the default options >for MariaDB windows installer cause this option to be enabled, whereas I had previous never designed my application for the various modes supported.
Hi Bruce, sql_mode includes STRICT_TRANS_TABLES is in MariaDB Windows installer, since they are in MySQL Windows installer - in current 5.5 installer, and in the past ones as well. One thing that changed in 5.5 (MySQL, and MariaDB) as compared to earlier versions, is that default storage engine is now transactional (Innodb/XtraDB). Wlad
participants (2)
-
Bruce Kirkpatrick
-
Vladislav Vaintroub