Home › Forums › Calendar Products › Events Calendar PRO › WordPress database error: [Not unique table/alias]
- This topic has 10 replies, 2 voices, and was last updated 10 years, 5 months ago by Chris.
-
AuthorPosts
-
October 11, 2013 at 10:51 am #70572MichaelParticipant
It seems the latest update nuked something.
I add metaboxes to pages, posts and tribe_events. On the homepage, a WP_Query looks for a specific meta key/value, in order to display a few featured items.
This has previously worked fine – after updating to 3.1, I’m getting the following error: WordPress database error: [Not unique table/alias: ‘cdc_postmeta’] (check out the site for more info, it’s a development install – I left the error up there)
If I restrict the query to just posts and pages, everything works as expected. Help, please – I’m not even sure where I should start looking…
October 13, 2013 at 9:02 pm #70804ChrisParticipantI think the error might tell you everything. Looks like either you’ve lost your postmeta table or you’ve managed to have two of them. Can you check to make sure you still have that table?
-Chris
October 14, 2013 at 5:42 am #70836MichaelParticipantphpMyAdmin tells me there is one postmeta table, and the right meta key/value pairs are there. Nothing looks weird in the WordPress admin area, either: custom fields show as expected.
Again: when I exclude tribe_events from the query, it works fine.
October 14, 2013 at 5:47 am #70839ChrisParticipantAre you on the latest version of all of the plugins running on your site?
Check the error log for your server. It might be a bit more verbose about that error.October 14, 2013 at 5:50 am #70840MichaelParticipantThis reply is private.
October 14, 2013 at 6:00 am #70843ChrisParticipantHmm, I’m wondering if the issue isn’t a failed database upgrade during the 3.1 update. Going to reassign to one of our other devs to have a look
-Chris
October 16, 2013 at 5:36 pm #71412MichaelParticipantTake your time…
October 18, 2013 at 8:04 am #71624ChrisParticipantHi there,
Okay so we took a look at the output, and I missed the really obvious thing here. There’s a table being joined in that query called “nrv_featured_item”. That’s not one of our tables, so its got to be coming from some sort of plugin or theme you’ve got installed.Can you try deactivating your plugins one by one. Likely your looking for a plugin with NRV or something that deals with Featured Items.
-Chris
October 18, 2013 at 8:34 am #71637MichaelParticipantYes, nrv_featured_item is the meta_key that allows items (Posts, Pages and Events) to be queried and thus featured on the homepage.
Yes, that’s the problem, and if I turn it off, I don’t have a database error.
As I stated a week ago, this worked fine before the upgrade to 3.1, and it does work fine when I exclude tribe_events from the query.
The nrv_featured_item key/value pair shows in the Custom Fields box for the events in question, everything looks normal there, no PHP notices or warnings.
Is there something you’ve changed in 3.1 with regards to how custom field keys/values are stored for the tribe_events post type? Would you like me to post up the code for the metaboxes and/or the WP_Query somewhere?
I am using the WPAlchemy WordPress MetaBox PHP Class:
https://github.com/farinspace/wpalchemyOctober 18, 2013 at 9:07 am #71644ChrisParticipantWe’re joining with postmeta by adding a meta_query arg to WP_Query. Probably ‘nrv_featured_item’ is being joined by adding SQL directly, and it’s not aliasing the table name. E.g., it’s doing “LEFT JOIN {$wpdb->postmeta} ON {$wpdb->postmeta}.meta_key=’nrv_featured_item'”, where it should be doing something like “LEFT JOIN {$wpdb->postmeta} nrv ON nrv.meta_key=’nrv_featured_item'”, giving a unique alias for the meta table for that join.
-Chris
October 31, 2013 at 5:11 am #73969ChrisParticipantHi there,
Since we haven’t heard from you in a while, I’m going to close this ticket. If you need further help, feel free to open a new ticket 🙂-Chris
-
AuthorPosts
- The topic ‘WordPress database error: [Not unique table/alias]’ is closed to new replies.