[wp-trac] [WordPress Trac] #12773: dbDelta fails to create multiple tables with IF NOT EXISTS

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 30 13:48:46 UTC 2010


#12773: dbDelta fails to create multiple tables with IF NOT EXISTS
--------------------------+-------------------------------------------------
 Reporter:  scibuff       |       Owner:                             
     Type:  defect (bug)  |      Status:  new                        
 Priority:  normal        |   Milestone:  Unassigned                 
Component:  General       |     Version:  2.9.2                      
 Severity:  normal        |    Keywords:  dbDelta, wpdb, create table
--------------------------+-------------------------------------------------
 using the dbDelta function with a query containing multiple CREATE TABLE
 will fail to create all but the last table: e.g


 {{{
 dbDelta(
         CREATE TABLE IF NOT EXISTS `A` (...);
         CREATE TABLE IF NOT EXISTS `B` (...);
 )
 }}}

 will create only the B table

 It seems that the function doesn't parse the SQL correctly and attempts to
 create a table called 'IF'

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12773>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list