[wp-trac] [WordPress Trac] #36948: dbDelta doesn't support SPATIAL KEY syntax

WordPress Trac noreply at wordpress.org
Thu May 26 04:21:23 UTC 2016

#36948: dbDelta doesn't support SPATIAL KEY syntax
 Reporter:  stuporglue       |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
 dbDelta can create spatial indexes on the initial CREATE TABLE call, but
 subsequent calls to dbDelta don't recognize the existing spatial index,
 resulting in a MySQL error indicating that it's trying add a new column.

     You have an error in your SQL syntax; check the manual that
 corresponds to your MariaDB server version for the right syntax to use
 near 'SPATIAL KEY (meta_value)' at line 1
     {{{ALTER TABLE wp_index_test ADD COLUMN SPATIAL KEY (meta_value)}}}

 MySQL has supported spatial columns and indexes since version 5.4. The
 syntax has remained the same since 5.4.

  * [https://docs.oracle.com/cd/E19957-01/mysql-refman-5.4/sql-syntax.html
 #create-table Create Table in v5.4]
  * [http://dev.mysql.com/doc/refman/5.7/en/create-table.html Create Table
 in v5.7]

 Adding spatial index support to dbDelta would allow developers to create
 and use tables with spatial columns while continuing to use dbDelta.

 SPATIAL index syntax is the same as FULLTEXT support which dbDelta already
 supports. As such, adding support is a simple one line change.

 Note: dbDelta works correctly for creating spatial columns. It's just
 indexes that it chokes on.

Ticket URL: <https://core.trac.wordpress.org/ticket/36948>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list