ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comment Module tag sql error

September 06, 2011 4:32am

Subscribe [5]
  • #1 / Sep 06, 2011 4:32am

    afrihost

    5 posts

    When doing a simple exp:comment:entries tag with dynamic set to “no”, it causes a sql query error.
    Removing the dynamic variable remedies the error but then breaks the page as it doesn’t return results (obviously).

    The error is as such

    Error Number: 1052
    Column ‘comment_date’ in field list is ambiguous

    SELECT `comment_date`, `comment_id` FROM (`exp_comments` c, `exp_comments`) JOIN `exp_channel_titles` ct ON `ct`.`entry_id` = `c`.`entry_id` WHERE `c`.`status` = ‘o’ AND `c`.`channel_id` IN (‘9’, ‘5’) AND `ct`.`status` != ‘closed’ AND `c`.`site_id` IN (‘1’) AND (`ct`.`expiration_date` = 0 OR `ct`.`expiration_date` > 1315293869) ORDER BY `comment_date` desc LIMIT 15

    Filename: modules/comment/mod.comment.php

    Line Number: 475

    The problem is in “(`exp_comments` c, `exp_comments`)”

    The comments table is being called twice, which causes a duplication of the comment_date field and hence the error.

    I’ve temporarily overcome this by keeping the comment module’s model from 2.2.2 but using the mcp, mod and upd files from version 2.1.1. This is not ideal however as I’m not certain wether this breaks other functionality or will cause other issues down the line.

    There is clearly a bug in the new mod.comment.php file which needs to be corrected expediently.

  • #2 / Sep 06, 2011 8:06pm

    Dan Decker

    7338 posts

    afrihost,

    Welcome to the Forums! I’m sorry you’ve run into this. I’m going to try and replicate on a local install to verify that is is a bug. Thanks for bringing this to our attention.

    Cheers,

  • #3 / Sep 09, 2011 3:25pm

    Aaron Fowler

    113 posts

    Hi Dan and afrihost,

    Is this the same comment pagination error that’s in the bug tracker?
    https://support.ellislab.com/bugs/detail/16389/

    Afrihost, does the fix listed in the bug report work for you?

    -Aaron

  • #4 / Sep 12, 2011 3:00am

    John Henry Donovan

    12339 posts

    Thanks Aaron.

    That does look like the bug in question afrihost. Can you replace your EE2.2.2. comment module files and try applying the patch supplied in the bug comments and let us know if the issue persists.

  • #5 / Sep 12, 2011 4:34am

    afrihost

    5 posts

    This has fixed this error yes.

    In the meantime I have noticed another issue since migrating from 2.1.1 to 2.2.2.

    All the pagination links are now broken - they produce urls such as “/&per_page=N15” and “/&per_page=P25” instead of just the N15 or P25 that used to define the pagination URL. Obviously the URLs above do not work - unless of course the “&per;_page=” is removed but that’s manual per url and we can’t exactly tell our customers to do that.

  • #6 / Sep 12, 2011 12:58pm

    Lisa Wess

    20502 posts

    Hi, afrihost -

    In system/expressionengine/config/config.php, have you modified enable_query_strings?

    Can you let us know what that line says?

    Thanks!

  • #7 / Sep 13, 2011 6:14am

    afrihost

    5 posts

    That line was set to true for some reason (strange) - have set to false and the issue is resolved

  • #8 / Sep 13, 2011 11:34am

    Mark Bowen

    12637 posts

    Hi afrihost,

    Glad to see you’re all squared away now.

    Please don’t hesitate to post again in the future as needed.

    Thanks,

    Mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases