[wp-trac] [WordPress Trac] #20263: Backticks in dbDelta cause warning and actually causes a query to alter all columns and indexes to run even if none have changed

WordPress Trac noreply at wordpress.org
Fri May 27 11:56:31 UTC 2016


#20263: Backticks in dbDelta cause warning and actually causes a query to alter all
columns and indexes to run even if none have changed
--------------------------------------+----------------------
 Reporter:  Driskell                  |       Owner:  ocean90
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  4.6
Component:  Database                  |     Version:  1.5
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-unit-tests has-patch  |     Focuses:
--------------------------------------+----------------------
Changes (by ocean90):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"37583"]:
 {{{
 #!CommitTicketReference repository="" revision="37583"
 Database: Normalize index definitions in `dbDelta()`.

 `dbDelta()` compares the index definitions against the result of `SHOW
 INDEX FROM $table_name`. This requires a specific format so indices are
 not unnecessarily re-created. This format wasn't ensured, until now.

 * Parse the raw index definition to extract the type, name and columns so
 a normalized definition can be built (#20263, #34873).
 * Standardize on uppercase types (#34871) and on 'KEY'. 'INDEX' is only a
 synonym for 'KEY'.
 * Escape index names with backticks (#20263).
 * Normalize columns: Ignore ASC and DESC definitions (#34959), remove
 whitespaces (#34869) and escape column names with backticks (#20263).
 * Add backticks to all index change queries (#20263).

 Props ocean90, pento, kurtpayne.
 Fixes #20263, #34869, #34871, #34873, #34959.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20263#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list