WordPress database error Not unique table/alias

Home Forums Calendar Products Events Calendar PRO WordPress database error Not unique table/alias

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #82635
    Michael
    Participant

    Ever since a client of our updated this plugin we’re now running up against this error:

    [18-Dec-2013 23:54:23 UTC] WordPress database error Not unique table/alias: ‘wp_postmeta’ for query SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.*, IF (wp_posts.post_type = ‘tribe_events’, wp_postmeta.meta_value, wp_posts.post_date) AS post_date FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) LEFT JOIN wp_postmeta on wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = ‘_EventStartDate’ WHERE 1=1 AND wp_posts.post_type IN (‘post’, ‘page’, ‘tribe_events’) AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_author = 2 AND wp_posts.post_status = ‘private’) AND ( (wp_postmeta.meta_key = ‘_feature’ AND CAST(wp_postmeta.meta_value AS CHAR) = ‘on’) ) ORDER BY post_date DESC LIMIT 0, 10 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/redDoorProject/front-page.php’), get_footer, locate_template, load_template, require_once(‘/themes/redDoorProject/footer.php’), include(‘/themes/redDoorProject/includes/feature.php’), WP_Query->__construct, WP_Query->query, WP_Query->get_posts

    which is preventing the entire feature to fail at displaying posts.

    the WP_Query that is being used is:

    $the_query = new WP_Query(
    array(
    ‘post_type’ => array(
    ‘post’,
    ‘page’,
    ‘tribe_events’
    ),
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘_feature’,
    ‘value’ => ‘on’
    )
    ),
    )
    );

    Only content with the custom meta value of ‘_feature’ should be display, yet none are.

    If I remove the ‘tribe_events’ from the WP_Query’s ‘post_type’ array, then the feature successfully shows all posts and pages that have the ‘_featured’ custom meta checked.

    Please advise.
    -M

    #82649
    Barry
    Member

    Hi M,

    This is almost certainly a conflict with your theme or another plugin and my guess would be both our code and that of the other component are essentially trying to perform a similar database query operation on the same table.

    The only thing that makes me doubt that is that you noted you had tried deactivating all other plugins and switching to a default theme … can you confirm if that did or did not resolve this? Any workaround (not that I can guarantee providing one) would really hinge on knowing with which item them conflict is occurring.

    #82659
    Michael
    Participant

    Can you point me to the file that alters the WP_Query call? Or where it is that the plugin modifies the resulting SQL query?

    #82667
    Michael
    Participant

    Nevermind, I’ve rolled back the plugin to v3.0.3 and it’s working perfectly now.

    #82764
    Barry
    Member

    OK, if you’re happy sticking with 3.0.3 that’s fine – but do bear in mind we can only offer very limited support for older versions of the plugin.

    I also, somehow, misread your initial post – but since this is centred on a custom query of yours I think we could knock out the filter that adds an additional join (within our code) temporarily while your custom query runs, if that’s of interest? It could then be restored to allow normal operation elsewhere.

    #82847
    Michael
    Participant

    I’d love to update to 3.3, but

    1. my events listings in the backend straight up disappeared.

    2. the appeal of an events plugin that uses wordpress’ custom post types were that you could query them like any other post type. However this simple and completely valid query now fails:

    $the_query = new WP_Query(
    array(
    ‘post_type’ => array(
    ‘post’,
    ‘page’,
    ‘tribe_events’
    ),
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘_feature’,
    ‘value’ => ‘on’
    )
    ),
    )
    );

    I’ve seen this type of thing being reported elsewhere and in every scenario the ticket is shrugged off as being an issue with the customers code.

    For the interest of this plugins future, I highly recommend this bug be identified and patched.

    Until that time, I simply must urge my client to stick with the old versions.

    -M

    #82912
    Barry
    Member

    We’re certainly not shrugging it off – and would be happy to help at any point if you do update to the latest version. We do already have this on our issue tracker as something in need of attention and I should perhaps have made that clearer earlier in the thread: we do strive to make our plugin behave as a good citizen of the WordPress environment and we have admittedly fallen a little short here.

    Once again, feel free to reach out to us at any point, but since it sounds like you are comfortable with using an earlier version of the plugin at least for the time being I will go ahead and close this thread.

    Thanks!

    #95339
    Leah
    Member

    Hi there,

    I’m happy to report that we have fixed this in our upcoming version 3.4. Keep an eye on your Plugins page for an update message! Thanks for your patience while we worked on this.

    Best,
    Leah

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘WordPress database error Not unique table/alias’ is closed to new replies.