Wordpress database error

Looking at our error.log we are seeing a lot of the following error. Can you tell us where we should start investigating and fix this error?

[Mon Mar 06 14:42:49.434930 2017] [:error] [pid 9000] [client 162.158.78.203:30512] 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 'and meta_key='_wp_attached_file'' at line 1 for query SELECT meta_value FROM wp_postmeta WHERE post_id= and meta_key='_wp_attached_file' made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/themify-peak/single.php'), get_footer, locate_template, load_template, require_once('/themes/themify-peak/footer.php'), themify_the_footer_text, apply_filters('themify_the_footer_text_right'), WP_Hook->apply_filters, call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, dover_footer, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, adviser_shortcode, getFileFromMainSite