Home › Forums › Calendar Products › Events Calendar PRO › WordPress database error Not unique table/alias
- This topic has 7 replies, 3 voices, and was last updated 12 years, 3 months ago by
Leah.
-
AuthorPosts
-
December 18, 2013 at 4:30 pm #82635
Michael
ParticipantEver 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.
-MDecember 18, 2013 at 4:36 pm #82649Barry
MemberHi 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.
December 18, 2013 at 5:25 pm #82659Michael
ParticipantCan you point me to the file that alters the WP_Query call? Or where it is that the plugin modifies the resulting SQL query?
December 18, 2013 at 6:57 pm #82667Michael
ParticipantNevermind, I’ve rolled back the plugin to v3.0.3 and it’s working perfectly now.
December 19, 2013 at 5:29 am #82764Barry
MemberOK, 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.
December 19, 2013 at 10:41 am #82847Michael
ParticipantI’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
December 19, 2013 at 3:03 pm #82912Barry
MemberWe’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!
January 21, 2014 at 2:48 pm #95339Leah
MemberHi 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 -
AuthorPosts
- The topic ‘WordPress database error Not unique table/alias’ is closed to new replies.
