[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 Mar 20 16:56:29 UTC 2015
#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:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 1.5
Severity: minor | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Comment (by davidmosterd):
Little context: Here with a mentor (Mark Jaquith) on contributor day
WordCamp London 2015 and just looking to get my first commit going, found
this ticket :)
We did this assumption: When you supply a CREATE TABLE statement,
`dbDelta()` should handle what MySQL gives you when you export the CREATE
TABLE statement
I tried to simplify this case by first removing the first appearance of
the column name from the query, and then `ltrim()` from the remainder any
remaining spaces and an optional backtick (in case the column name was
enclosed in backticks). The string should now start with the data type,
maybe having " unsigned" behind it. The remaining `preg_match()` is quite
simple now.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/20263#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list