[wp-trac] Re: [WordPress Trac] #8949: WP creates duplicate options

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 2 11:28:14 GMT 2009


#8949: WP creates duplicate options
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |        Owner:  anonymous
     Type:  defect (bug)       |       Status:  new      
 Priority:  low                |    Milestone:  2.8      
Component:  Optimization       |      Version:  2.7      
 Severity:  minor              |   Resolution:           
 Keywords:  needs-patch        |  
-------------------------------+--------------------------------------------
Comment (by Denis-de-Bernardy):

 Replying to [comment:2 mrmist]:
 > At the risk of teaching granny to suck eggs, you still need to enforce
 the unqiueness at app level, or at least handle the constraint error in
 the event of an insert that's non-compliant.

 Agreed, but that wouldn't fix race conditions, if two separate processes
 are trying to insert the same option. When this happens, the sql insert
 should silently fail, and wp should fallback to an sql update of the same
 option.

 With our current version of MySQL, we could use a replace into statement
 rather than an insert into statement in add_option(), at the of ending up
 with an unpredictable option_id.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8949#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list