View Issue Details

IDProjectCategoryView StatusLast Update
0019403phpList 3 applicationSubscriber Importpublic19-07-19 14:41
Reporterduncanc Assigned To 
Status resolvedResolutionfixed 
Product Version3.3.3 
Target Version3.3.5Fixed in Version3.3.5 
Summary0019403: Use of mysql "replace into"
DescriptionThe mysql "replace into" statement is used in several places as a convenient way to handle inserting a record or updating when a record for the the key field already exists.

The "replace into" statement actually deletes the current record and adds a new record. If the table has an autoincrement field or a field that defaults to the current timestamp, then the new record will be different to the original record even when no other field has changed. In many cases that should be ok but it causes a problem for the Autoresponder plugin when used on the listuser table by the import pages.

If you import an existing subscriber, say on the simpleimport page, then the user record remains the same but the record in listuser for the list/user combination has new values for the entered and modified fields.
The Autoresponder plugin uses the modified field on listuser as part of the criteria to decide whether to send the campaign to that subscriber. If the modified field is changed in this way then a campaign may be sent to the subscriber when it shouldn't.
That problem was reported in the user forum,

An alternative to "replace into" is to use "insert ignore" for the cases when we want to insert when the record does not already exist and make no change when the record does exist. These cases include inserting into the listuser tableby the import pages and the copy and move commands on the list membership page.
TagsNo tags attached.



12-09-18 15:43

updater   ~0061088

See Pull Request