Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12632 closed defect (bug) (invalid)

Sporatic database error message

Reported by: marilynburgess Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 2.9.2
Component: Database Keywords: reporter-feedback
Focuses: Cc:


This problem is happening on multiple blogs across 2 separate servers. I am consistently getting the message:

"WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '1266304744 at line 1 for query SELECT comment_id FROM WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '1266304744' made by do_action_ref_array, call_user_func_array, wp_scheduled_delete"

in my error log. As far as I can tell, the error is thrown every time the cron is run.

The table name missing from the sql statement is clearly the problem, originating from line #3553 in /wp-includes/functions.php, which is being called from the trash collecting cron. I have no clue as to why "$wpdb->commentmeta" is returning an empty string.

Change History (7)

#1 @dd32
8 years ago

  • Keywords reporter-feedback added; database error cron wp_scheduled_delete removed
  • Milestone changed from Unassigned to 3.0

Are you using any drop-in database replacements? Look for a wp-content/db.php file to check that.

#2 @marilynburgess
8 years ago

The are no wp-content/db.php files, so I guess not.

#3 @nacin
8 years ago

Best I can tell, this is not a bug in the WordPress core. You're running a plugin that is causing $wpdb->commentmeta to not be set.

Odds are, the plugin has the tables hard-coded (commentmeta was added in 2.9). This was seen in a few plugins.

#4 @marilynburgess
8 years ago

I don't believe the culprit is a plugin. One of the offending blogs has only 2 plugins, and neither of the plugins have the db tables hardcoded. I verified this by searching for the phrase "postmeta".

Looking in /wp-includes/wp-db.php I can see no reference to commentmeta. I think this is the problem.

I put a call to wp_scheduled_delete() in /wp-admin/admin.php to verify that the errors occurred every time that function is called, which it does, several times when I load the admin page. I then added commentmeta to the /wp-includes/wp-db.php file. No errors appeared when I loaded the admin page again.

#5 @nacin
8 years ago

  • Milestone 3.0 deleted
  • Resolution set to invalid
  • Status changed from new to closed

As you can see here, commentmeta is referenced in wp-db.php in 2.9. You indicated you were running 2.9.2, which you can see here.

I would re-install/upgrade, as it appears at least one file was not updated on last upgrade.

#6 @marilynburgess
8 years ago

Fair enough.

I always use the upgrade automatically feature. Is it common for it to miss files in the manner?

#7 @dd32
8 years ago

I always use the upgrade automatically feature. Is it common for it to miss files in the manner?

Never heard of it missing a file yet AND giving a success message.

There are mentions of it timing out half way through and/or giving a failure message when it couldnt access a file on the server however.

Note: See TracTickets for help on using tickets.