[wp-trac] [WordPress Trac] #63976: dbDelta returns unnecessary update if tablename is in backticks

WordPress Trac noreply at wordpress.org
Mon Sep 15 10:15:59 UTC 2025


#63976: dbDelta returns unnecessary update if tablename is in backticks
--------------------------+-----------------------------
 Reporter:  leewillis77   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  6.8.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If the SQL passed to dbDelta has backticks around the tablename, then
 dbDelta will always return an update implying that the table will be
 created, even if it already exists and no changes are required.

 E.g. the following code:
 {{{#!php
 <?php

 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
 $for_update = dbDelta('CREATE TABLE `foo` (id INT)');
 }}}

 will always return the following array, even when the table exists and no
 changes are required:

 {{{
 [`foo`] => Created table `foo`
 }}}

 Patch to follow

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


More information about the wp-trac mailing list