Comments - Generated (Virtual and Persistent/Stored) Columns

5 years, 9 months ago Jan Steinman

How can one avoid getting warnings when there is an attempt to change a generated column?

I'm doing data entry using Sequel Pro (on Mac), and I will often duplicate and edit a row that is similar to the one I need.

It used to let me do that, and would simply "fix" the generated column appropriately. For example, I often use a generated column to show the day of the week for a DATE column. On duplication, modification of the DATE field, and saving, the day of week would change properly.

But now, I get a notifier: "Unable to write row. The value specified for generated column 'Day' in table 's_product_sales_log' ignored."

It was successfully ignoring such things, but then I had a power failure, and then something changed. I must have changed some dynamic variable to get it to work properly before.

In grepping through the variables, I see:

• innodb_strict_mode OFF

  • sql_warnings OFF

Is there something else I need to set to allow this?

Some of my schemas have four or more generated columns. Tabbing through and putting NULL in each one, when all I want to do is have a duplicate record that differs by ONE field, is very tedious!

Thanks!

 
5 years, 8 months ago Sergei Golubchik

Yes, see STRICT_TRANS_TABLES and STRICT_ALL_TABLES values in sql_mode variable.

 
5 years, 8 months ago Jan Steinman

Thanks! I changed the variable, and things are working again... until the next reboot...

Is the preferred way of persisting this to put it in /etc/my.cnf, or should I start mysqld with "--sql_mode" set appropriately?

Jan

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.