View Issue Details

IDProjectCategoryView StatusLast Update
0000442WackoWikiinstallerpublic2017-08-31 09:36
ReporterbirnbacsAssigned Toadministrator 
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionduplicate 
Platformamd64OSFreeBSDOS Version9.2-RELEASE-p4
Product Version5.4.0 
Target Version5.5.0Fixed in Version5.5.0 
Summary0000442: populating tables fails
DescriptionDuring installation process, step 'database installation', the tables are installed OK but adding default data fails with this message:


Testing Configuration
[OK]

Installing Tables
[OK]

Adding Default Data

    Adding Default Pages
        Error inserting HomePage page - Field 'body_r' doesn't have a default value
        Error setting read permission for HomePage page - Column 'page_id' cannot be null
        Error setting write permission for HomePage page - Column 'page_id' cannot be null
        Error setting comment permissions for HomePage page - Column 'page_id' cannot be null
        Error setting create permissions for HomePage page - Column 'page_id' cannot be null
        Error setting upload permissions for HomePage page - Column 'page_id' cannot be null
        Error inserting Users/WikiAdmin page - Field 'body_r' doesn't have a default value
        Error setting read permission for Users/WikiAdmin page - Column 'page_id' cannot be null
        Error setting write permission for Users/WikiAdmin page - Column 'page_id' cannot be null
        Error setting comment permissions for Users/WikiAdmin page - Column 'page_id' cannot be null
        Error setting create permissions for Users/WikiAdmin page - Column 'page_id' cannot be null
        Error setting upload permissions for Users/WikiAdmin page - Column 'page_id' cannot be null
    Finished Adding Default Pages
    Adding Logo Image
    Adding Config Values


After this, home page is displayed but important pages like StartPage, register or login cannot be found. Wiki is not usable.

Steps To Reproducefollowed official installation procedure (wacko 5.4.0)
Additional InformationWacko 5.4.0
Apache 2.2
PHP 5.5.12
MySQL 5.6
database driver MySQLi
engine MyISAM

When db driver PDO is selected instead of MySQL, no table population is possible at all, installer stops.
TagsNo tags attached.

Relationships

related to 0000432 resolvedadministrator database: add missing default values 

Activities

administrator

2014-06-02 18:05

administrator   ~0000921

Default values

If the SQL_MODE contains STRICT_TRANS_TABLES and you are inserting into a transactional table (like InnoDB), or if the SQL_MODE contains STRICT_ALL_TABLES, all NOT NULL columns which does not have a DEFAULT value (and is not AUTO_INCREMENT) must be explicitly referenced in INSERT statements. If not, an error like this is produced:

ERROR 1364 (HY000): Field 'col_name' doesn't have a default value

---------

Workaround: set sql-mode line in my.ini to sql-mode =""

Fix in work..

birnbacs

2014-06-02 20:07

developer   ~0000922

Yes, that looks like it. Thanks for investigating. Meanwhile I found I could circumvent the problem by deinstalling php55 packages; going with PHP php5-5.4.28 from /usr/ports/lang/php5.

administrator

2014-06-04 13:35

administrator   ~0000923

Last edited: 2014-06-11 06:42

View 3 revisions

The solution is to give default values for all NOT NULL columns or be disciplined enough to define all columns with their values in a insert query statement.

implicit default column values:

Zero (0) for numeric data types.
Empty string for string data types other than ENUM.
Appropriate “Zero” values for temporal data types.

You can easily check which of your database tables has an empty DEFAULT value for NOT NULL columns with the following query.

USE information_schema;
 
SELECT TABLE_NAME, COLUMN_NAME
    FROM `columns`
    WHERE IS_NULLABLE = 'NO'
        AND COLUMN_DEFAULT IS NULL
        AND TABLE_SCHEMA= 'YOUR-DATABASE-NAME'

You can also check MySQL strict mode status with the following.

SELECT @@sql_mode

javafun

2014-06-09 18:35

reporter   ~0000924

In case MySQL settings change is not acceptable, you can modify sql for table 'page' in database_mysql.php.
Change nullability to 'default null' for "body_r" and "body_toc". Another option is to add default value.

$table_page = "CREATE TABLE {$pref}page (".
                    "page_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,".
                    "owner_id INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "user_id INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "title VARCHAR(100) NOT NULL DEFAULT '',".
                    "tag VARCHAR(250) NOT NULL DEFAULT '',".
                    "supertag VARCHAR(250) NOT NULL DEFAULT '',".
                    "menu_tag VARCHAR(250) NOT NULL DEFAULT '',".
                    "depth INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "parent_id INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',".
                    "modified DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',".
                    "body MEDIUMTEXT NOT NULL,".
                    "body_r MEDIUMTEXT DEFAULT NULL,".
                    "body_toc TEXT DEFAULT NULL,".
                    "formatting VARCHAR(20) NOT NULL DEFAULT 'wacko',".
                    "edit_note VARCHAR(100) NOT NULL DEFAULT '',".
                    "minor_edit TINYINT(1) UNSIGNED DEFAULT '0',".
                    "reviewed TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',".
                    "reviewed_time DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',".
                    "reviewer_id INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "ip VARCHAR(15) NOT NULL DEFAULT '',".
                    "latest TINYINT(1) UNSIGNED DEFAULT '1',".
                    "handler VARCHAR(30) NOT NULL DEFAULT 'page',".
                    "comment_on_id INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "comments INT(4) UNSIGNED NOT NULL DEFAULT '0',".
                    "hits INT(10) UNSIGNED NOT NULL DEFAULT '0',".
                    "theme VARCHAR(20) DEFAULT NULL,".
                    "lang VARCHAR(2) NOT NULL DEFAULT '',".
                    "commented DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',".
                    "description VARCHAR(250) NOT NULL DEFAULT '',".
                    "keywords VARCHAR(250) BINARY NOT NULL DEFAULT '',".
                    "footer_comments TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "footer_files TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "footer_rating TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "hide_toc TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "hide_index TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "tree_level TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',".
                    "show_menu_tag TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',".
                    "allow_rawhtml TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "disable_safehtml TINYINT(1) UNSIGNED NULL DEFAULT NULL,".
                    "noindex TINYINT(1) UNSIGNED NULL DEFAULT '0',".
                    "deleted TINYINT(1) UNSIGNED NULL DEFAULT '0',".
                    "PRIMARY KEY (page_id),".
                    "KEY idx_user_id (user_id),".
                    "KEY idx_owner_id (owner_id),".
                    "FULLTEXT KEY body (body),". // InnoDb up to MySql 5.6 or MariaDB: #1214 - The used table type doesn't support FULLTEXT indexes
                    "UNIQUE KEY idx_tag (tag),".
                    "KEY idx_supertag (supertag),".
                    "KEY idx_depth(depth),".
                    "KEY idx_created (created),".
                    "KEY idx_modified (modified),".
                    "KEY idx_minor_edit (minor_edit),".
                    "KEY idx_deleted (deleted),".
                    "KEY idx_reviewed (reviewed),".
                    "KEY idx_comment_on_id (comment_on_id),".
                    "KEY idx_commented (commented),".
                    "KEY idx_title (title)".
                ") {$engine} COMMENT='' {$charset}";

administrator

2014-06-11 07:56

administrator   ~0000926

Last edited: 2014-06-11 07:59

View 3 revisions

Patch commited: http://wackowiki.hg.sourceforge.net/hgweb/wackowiki/dev/rev/c66efc731117

TODO: Testing + Adding changes also to Upgrade routine for 5.4

see -> 0000432

Issue History

Date Modified Username Field Change
2014-05-20 21:50 birnbacs New Issue
2014-06-02 18:05 administrator Note Added: 0000921
2014-06-02 18:05 administrator Status new => acknowledged
2014-06-02 18:05 administrator Product Version => 5.4.0
2014-06-02 18:05 administrator Target Version => 5.6.x
2014-06-02 20:07 birnbacs Note Added: 0000922
2014-06-04 13:35 administrator Note Added: 0000923
2014-06-04 13:36 administrator Note Edited: 0000923 View Revisions
2014-06-04 15:05 administrator Assigned To => administrator
2014-06-04 15:05 administrator Status acknowledged => assigned
2014-06-09 18:35 javafun Note Added: 0000924
2014-06-11 06:42 administrator Note Edited: 0000923 View Revisions
2014-06-11 06:50 administrator Relationship added related to 0000432
2014-06-11 07:56 administrator Note Added: 0000926
2014-06-11 07:56 administrator Note Edited: 0000926 View Revisions
2014-06-11 07:58 administrator Status assigned => resolved
2014-06-11 07:58 administrator Resolution open => duplicate
2014-06-11 07:58 administrator Fixed in Version => 5.6.x
2014-06-11 07:59 administrator Note Edited: 0000926 View Revisions
2015-02-19 19:19 administrator Target Version 5.6.x => 5.5.0
2016-09-21 09:18 administrator Fixed in Version 5.6.x => 5.5.rc2
2017-08-31 09:36 administrator Fixed in Version 5.5.rc2 => 5.5.0