• Resolved Jan Jakeš

    (@janjakes)


    Given the following table:

    CREATE TABLE testing (
      id int(11) NOT NULL AUTO_INCREMENT,
      content text DEFAULT NULL,
      PRIMARY KEY (id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

    And the following data:

    INSERT INTO testing (content) VALUES (NULL);

    The plugin saves the following SQL to the backup archive:

    /* CUSTOM VARS START */
    /* REAL_TABLE_NAME: testing; */
    /* PRE_TABLE_NAME: 1675859812_testing; */
    /* CUSTOM VARS END */
    
    CREATE TABLE IF NOT EXISTS 1675859812_testing ( id int(11) NOT NULL AUTO_INCREMENT, content text, PRIMARY KEY (id)) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
    INSERT INTO 1675859812_testing (id, content) VALUES (1,'');

    That’s wrong. The data should be VALUES (1,NULL) instead of VALUES (1,'').

    This also causes errors in other plugins after the backup is restored. Such as this one: https://ww.wp.xz.cn/support/topic/migration-class-mailpoetmigrationsmigration_20221108_140545-not-found/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jan Jakeš

    (@janjakes)

    Seeing how the code formatting is damaged after saving, here’s what the original post looks like in the editor:

    Plugin Author iClyde

    (@iclyde)

    Hi @janjakes

    Thank you for your report!
    So far, I don’t remember any case where such issue applied during migration.

    I am also not sure, if that can make real issues as when you insert data, when table has DEFAULT NULL value “” string should be replaced with NULL.

    If there is NOT NULL, it can’t be NULL of course, so “” is more valid.

    In case of wp_options, and use of get_option function NULL and “” will be the same value in terms of conditional check.

    Nevertheless, we will inspect it further and include solution in upcoming version 🙂

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘NULL values are exported as empty strings’ is closed to new replies.