[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
Thu May 26 05:43:54 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:  reviewing
 Priority:  normal                    |   Milestone:  4.6
Component:  Database                  |     Version:  1.5
 Severity:  normal                    |  Resolution:
 Keywords:  has-unit-tests has-patch  |     Focuses:
--------------------------------------+------------------------

Comment (by pento):

 In [attachment:20263.7.diff]:

 * Updated the patch to apply cleanly after [37574].
 * Added `SPATIAL` to the index `preg_match()` and tidied it up a little.
 * Merged two `trim()` calls at the start of `foreach ( $flds...`. (The
 sequential trims didn't operate quite the same as previous usage.)

 I like the direction of this patch. My primary concern is that the new
 index matching chunk of code is fairly dense, it could do with some
 whitespace, and maybe even some comments (forbid the thought!). I don't
 relish the idea of trying to remember how this all works when our next
 `dbDelta()` maintenance spree comes around.

 Oh, and I forgot to fix it it my patch - after `foreach (
 $index_columns...` we need to `unset( $index_column )`.

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


More information about the wp-trac mailing list