Plugin Directory


Opened 7 years ago

#1289 new defect

Duplicate INSERT commands for auto draft records

Reported by: Undebtedly Owned by: skippy
Priority: normal Severity: normal
Plugin: wp-db-backup Keywords: auto-draft, duplicate, insert


Our wp_posts table contains two auto-draft records. In the SQL dump that Wp-Db-Backup produces, two insert commands are generated to include these two records into the restored database:

INSERT INTO wp_posts VALUES (12146, 1, '2011-03-01 06:28:37', '0000-00-00 00:00:00', '', '自动草稿', '', 'auto-draft', 'open', 'open', '', '', '', '', '2011-03-01 06:28:37', '0000-00-00 00:00:00', '', 0, 'http://www.yihanyingcihui.net/?p=12146', 0, 'post', '', 0);
INSERT INTO wp_posts VALUES (12147, 1, '2011-03-01 19:27:11', '0000-00-00 00:00:00', '', 'Auto Draft', '', 'auto-draft', 'open', 'open', '', '', '', '', '2011-03-01 19:27:11', '0000-00-00 00:00:00', '', 0, 'http://www.yihanyingcihui.net/?p=12147', 0, 'post', '', 0);

In the SQL dump, at the end of the section to restore data contents to wp_posts, these exact two commands generated again, with the exact same post_id values. Of course, post_id is the primary key for the table, and the second attempt at inserting the same key errors out.

The solution probably might be to filter out the auto-draft records from getting included into the SQL dump. But then will the problem pop up some other way? If I come up with a solution I'll try to post it here.

Change History (0)

Note: See TracTickets for help on using tickets.