• Resolved Preliot

    (@preliot)


    I’m seeing these sql errors in my log file. Because it was unreadable, i’ve added whitespaces. Also replace my theme name with <theme>.

    [28-Apr-2022 23:39:44 UTC] WordPress databasefout You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near

    '))) AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' ...'

    at line 3 bij query

    SELECT wp_posts.* 
    FROM wp_posts  
    LEFT JOIN wp_icl_translations wpml_translations
    ON wp_posts.ID = wpml_translations.element_id
    AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type)  WHERE 1=1  
    AND ((()))  
    AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'aiovg_videos' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'news' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) 
    OR (wp_posts.post_type = 'custom_type' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))) 
    AND (((wpml_translations.language_code = 'nl' OR 0 ) 
    AND wp_posts.post_type  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' ))
    OR wp_posts.post_type  NOT  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' ))
    
    ORDER BY wp_posts.post_date DESC  
                                    
    gemaakt door 
    require('wp-blog-header.php'), 
    require_once('wp-includes/template-loader.php'), 
    include('/themes/<theme>/search.php'), 
    get_footer, 
    locate_template, 
    load_template, 
    require_once('/themes/<theme>/footer-without-newsletter.php'), 
    get_template_part, 
    locate_template, 
    load_template, 
    require('/themes/<theme>/partials/footer/footer-end.php'), 
    wp_footer, 
    do_action('wp_footer'), 
    WP_Hook->do_action, 
    WP_Hook->apply_filters, 
    WpMatomo\TrackingCode->add_javascript_code, 
    WpMatomo\TrackingCode\TrackingCodeGenerator->get_tracking_code, 
    WpMatomo\TrackingCode\TrackingCodeGenerator->apply_search_changes, 
    WP_Query->__construct, 
    WP_Query->query, 
    WP_Query->get_posts
    • This topic was modified 2 years, 7 months ago by Preliot.
    • This topic was modified 2 years, 6 months ago by Jan Dembowski.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @preliot

    I’m sorry but your problem doesn’t look like related to the matomo plugin.

    Kind regards

    Mat

    Thread Starter Preliot

    (@preliot)

    Hello Mat,

    The stacktrace starts in my footer with the wp footer hook which triggers add_javascript_code, which in turns starts this issue.

    But where should ik look? ACF? MariaDB? something else?

    • This reply was modified 2 years, 6 months ago by Preliot.

    hi @preliot

    can you share the callstack of this error?

    Kind regards

    Mat

    Thread Starter Preliot

    (@preliot)

    Hello @mattmary,

    Unfortunatly there’s no stacktrace, but this is the complete log message:

    [07-May-2022 10:29:10 UTC] WordPress databasefout You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')))  AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' ...' at line 3 bij query SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT  JOIN wp_icl_translations wpml_translations
    							ON wp_posts.ID = wpml_translations.element_id
    								AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type)  WHERE 1=1  AND ((()))  AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'aiovg_videos' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'news' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'custom_type' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))) AND ( ( ( wpml_translations.language_code = 'nl' OR 0 ) AND wp_posts.post_type  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' )  ) OR wp_posts.post_type  NOT  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' )  )  ORDER BY wp_posts.post_date DESC LIMIT 0, 10 gemaakt door require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
    [07-May-2022 10:29:10 UTC] WordPress databasefout You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')))  AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' ...' at line 3 bij query SELECT   wp_posts.* FROM wp_posts  LEFT  JOIN wp_icl_translations wpml_translations
    							ON wp_posts.ID = wpml_translations.element_id
    								AND wpml_translations.element_type = CONCAT('post_', wp_posts.post_type)  WHERE 1=1  AND ((()))  AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'aiovg_videos' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'news' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled')) OR (wp_posts.post_type = 'custom_type' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))) AND ( ( ( wpml_translations.language_code = 'nl' OR 0 ) AND wp_posts.post_type  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' )  ) OR wp_posts.post_type  NOT  IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','acf-field-group','product','product_variation','aiovg_videos','news' )  )  ORDER BY wp_posts.post_date DESC  gemaakt door require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/<theme>/search.php'), get_footer, locate_template, load_template, require_once('/themes/<theme>/footer-without-newsletter.php'), get_template_part, locate_template, load_template, require('/themes/<theme>/partials/footer/footer-end.php'), wp_footer, do_action('wp_footer'), WP_Hook->do_action, WP_Hook->apply_filters, WpMatomo\TrackingCode->add_javascript_code, WpMatomo\TrackingCode\TrackingCodeGenerator->get_tracking_code, WpMatomo\TrackingCode\TrackingCodeGenerator->apply_search_changes, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
    • This reply was modified 2 years, 6 months ago by Preliot.
    • This reply was modified 2 years, 6 months ago by Jan Dembowski.
    Thread Starter Preliot

    (@preliot)

    Last part tells the story where the call orginates (see topic start for better view).
    Any insight would be appreciated.

    Hi @preliot

    this is the get_search_query method which generates this bad sql request.
    You should look in your source code to the applied filters get_search_query: one of them generates this wrong part in your sql request.

    Thread Starter Preliot

    (@preliot)

    @mattmary Thanks for your efforts. With your suggestion i’ve traced the issue elsewhere (WooCommerce) and posted the issue here: WooCommerce sql syntax error.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘SQL syntax error in log’ is closed to new replies.