SQL error for Pro Recurrence Events

Home Forums Calendar Products Events Calendar PRO SQL error for Pro Recurrence Events

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1521228
    Eclipse Creative
    Participant

    Hello,

    I just wanted to flag a bug that popped up in an error_log file on my WP root folder as I don’t have debug enabled.

    First here’s the error;

    [15-Apr-2018 14:37:39 UTC] WordPress database error Unknown column 'post_parent' in 'group statement' for query 
    			SELECT
    				SQL_CALC_FOUND_ROWS *
    			FROM (
    				SELECT  DISTINCT wp_posts.ID FROM wp_posts  INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )  INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) LEFT JOIN wp_postmeta as tribe_event_end_date ON ( wp_posts.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' )  WHERE 1=1  AND ( 
      wp_postmeta.meta_key = '_EventStartDate' 
      AND 
      ( 
        ( mt1.meta_key = '_EventVenueID' AND CAST(mt1.meta_value AS SIGNED) = '2656' )
      )
    ) AND wp_posts.post_type = 'tribe_events' AND ((wp_posts.post_status = 'publish')) AND ((wp_postmeta.meta_value >= '2018-04-14 00:00:00' AND wp_postmeta.meta_value <= '2020-04-15 23:59:59') OR (tribe_event_end_date.meta_value >= '2018-04-14 00:00:00' AND wp_postmeta.meta_value <= '2020-04-15 23:59:59' ) OR (wp_postmeta.meta_value < '2018-04-14 00:00:00' AND tribe_event_end_date.meta_value >= '2020-04-15 23:59:59' )) ORDER BY wp_posts.post_date ASC 
    			) a
    			GROUP BY IF( post_parent = 0, ID, post_parent )
    			
    			LIMIT 0, 6
    		 made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, call_user_func, Tribe__Events__REST__V1__Endpoints__Archive_Event->get, Tribe__Events__REST__V1__Endpoints__Archive_Event->has_previous, tribe_get_events, Tribe__Events__Query::getEvents, WP_Query->__construct, WP_Query->query, WP_Query->get_posts

    Looking into this I found the injection of the GROUP By IF portion which is broken within the src/Tribe/Recurrence/Queries.php here on line 86;
    $group_clause = $query->query_vars['fields'] == 'id=>parent' ? 'GROUP BY ID' : 'GROUP BY IF( post_parent = 0, ID, post_parent )';

    The issue is basically the SQL query which is being manipulated has wp_posts and wp_postmeta tablenaming on variables but the injected GROUP BY IF statement just provides post_parent without the wp_posts. prefix.

    So please update the call to prefix with {$wpdb->posts} to avoid this error.

    Thank you

    #1521890

    Thanks so much for reaching out and for bringing our attention to this issue!

    Is this error causing any issues on your site?

    Let me know if you need assistance with further troubleshooting!

     

    Thanks,

    Jaime

    #1522419
    Eclipse Creative
    Participant

    Hi Jaime,

    Aside from the error message I’m unsure if this is causing any complications with Recurrence events but would assume they might not be replicating for future events and I believe that’s what caused the error.

    Thanks

    #1522765

    Thank you for your response.  If you do notice that they are not working properly in the future, let me know so that we can continue to troubleshoot the issue.

    Please note that threads automatically close in three weeks if there is no response, so feel free to open a new thread and reference this one with any additional questions.

    Let me know if you need any further assistance!

     

    Thanks,

    Jaime

    #1523092
    Eclipse Creative
    Participant

    Sounds good, I’ll keep my eyes on it thanks

    #1523140

    Great, thanks!

    #1539480
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘SQL error for Pro Recurrence Events’ is closed to new replies.