[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
Mon May 23 21:25:11 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 needs-patch  |     Focuses:
----------------------------------------+------------------------
Changes (by ocean90):

 * keywords:  has-patch early has-unit-tests => has-unit-tests needs-patch


Comment:

 Turns out the approach in [attachment:20263.patch] doesn't work because it
 would break a query where backticks are required, like for reserved
 keywords. [attachment:20263.4.diff] includes a test for that.

 In [attachment:20263.4.diff] I tried to escape every field in our custom
 tables which doesn't quite work because of the `array_search()` call.

 I'll take another look tomorrow and will probably copy parts of
 `BP_SQL_Schema_Parser:: get_index_definition()` and
 https://backpress.trac.wordpress.org/browser/trunk/includes/class.bp-sql-
 schema-parser.php?marks=118-143#L117 to `wpdb`.

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


More information about the wp-trac mailing list