Opened 7 months ago
Closed 7 months ago
#63976 closed defect (bug) (fixed)
dbDelta returns unnecessary update if tablename is in backticks
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | 6.8.2 |
| Component: | Database | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
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 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
Attachments (1)
Change History (5)
This ticket was mentioned in PR #9888 on WordPress/wordpress-develop by @leewillis77.
7 months ago
#1
- Keywords has-patch has-unit-tests added
Note: See
TracTickets for help on using
tickets.
This change ensures that dbDelta does not erroneously return an apparent update to tables when the tablename contains backticks.
Trac ticket: https://core.trac.wordpress.org/ticket/63976