View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0019403||phpList 3 application||Subscriber Import||public||12-09-18 16:33||19-07-19 15:41|
|Target Version||3.3.5||Fixed in Version||3.3.5|
|Summary||0019403: Use of mysql "replace into"|
|Description||The 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, https://discuss.phplist.org/t/autoresponder-sending-to-old-subscribers/4383/5
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.
|Tags||No tags attached.|