Star2Billing/a2billing

Errors with strict mode

miken32 opened this issue · 0 comments

When using the most recent MySQL or MariaDB releases, SQL strict mode defaults to enabled. Trying to insert a customer record fails because there are no default values set for many of the columns, and no values are provided in the query! Without strict mode, an empty value was inserted automatically. I'm sure there problems with many other INSERT queries.

This query will show affected columns (i.e. those that cannot be set to null, but have null as a default value.) Probably many of these want to have no default value because they're required, but others can be updated to have default value of empty string.

SELECT table_name, column_name, column_type
    FROM information_schema.columns
    WHERE table_schema='mya2billing'
        AND is_nullable='NO'
        AND column_default is NULL;