Title: Database Errors in Apache Error Log
Last modified: April 24, 2020

---

# Database Errors in Apache Error Log

 *  Resolved [jrigexor](https://wordpress.org/support/users/jrigexor/)
 * (@jrigexor)
 * [6 years ago](https://wordpress.org/support/topic/database-errors-in-apache-error-log/)
 * Hello. I don’t know if this changed recently, but I just started seeing database
   query errors in my Apache Error log. The errors look like this:
 * `WordPress database error Unknown column 'blacklist' in 'where clause' for query
   SELECT SUM(blockCount) as blockCount\nFROM wp_wfBlockedIPLog\nWHERE unixday >
   = FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval 7 day)) / 86400) AND blockType
   IN ("blacklist", "manual") made by do_action('toplevel_page_Wordfence'), WP_Hook-
   >do_action, WP_Hook->apply_filters, wordfence::menu_dashboard, require('/plugins/
   wordfence/lib/menu_dashboard.php')`
 * The issue appears to be caused by the queries made by the file:
 * wordfence/lib/wfActivityReport.php
 * at line 231. The issue is that the $groupingWHERE clause is surrounding the strings
   in the queries with double quotes, instead of single quotes. This isn’t an issue
   if the database backend is maria-db (AFAICT), but if the backend is a newer version
   of MySQL (in my case MySQL v8+), I will see these errors whenever this query 
   is run. From my preliminary research, it seems that single quotes instead of 
   double quotes surrounding strings is generally more portable across RDBMSs, so
   this may affect other queries, but this is the only instance that I’ve personally
   seen pop up.
 * If I replace the double quotes with single quotes I no longer see the error produced
   when running the query.
 * If you need anything more specific about this issue let me know and I will respond
   as soon as I can.
 * Thank you for you time.
 * P.S. I forgot to mention that I am seeing this error in the most recent version
   of Wordfence (v7.4.7 as of this writing).
    -  This topic was modified 6 years ago by [jrigexor](https://wordpress.org/support/users/jrigexor/).
    -  This topic was modified 6 years ago by [jrigexor](https://wordpress.org/support/users/jrigexor/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [jrigexor](https://wordpress.org/support/users/jrigexor/)
 * (@jrigexor)
 * [6 years ago](https://wordpress.org/support/topic/database-errors-in-apache-error-log/#post-12727666)
 * After some further digging, it appears that there were some changes made to managed
   database servers (when this was I don’t know – I only recently noticed these 
   errors) on Digital Ocean. The sql mode includes ANSI_QUOTES under the database
   settings which causes queries with double quotes to fail. Removing the ANSI_QUOTES
   settings fixes this issue and also address this problem that occurs with other
   plugins. Sorry for the mix up – hopefully if someone else sees this it can address
   their issue, and if anyone on your support forum shows up with a similar issue
   this can help them resolve it as well.

Viewing 1 replies (of 1 total)

The topic ‘Database Errors in Apache Error Log’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [jrigexor](https://wordpress.org/support/users/jrigexor/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/database-errors-in-apache-error-log/#post-12727666)
 * Status: resolved