Download & Extend

Version 2.5 completely breaks my web site

Project:Webform Report
Version:5.x-2.5
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

If I install the 2.0 version of this module, all heck breaks loose with the site, and it generates errors on almost every page in the site of more or less this form:]

Not that this is on all KINDS of table in the site, not just this one. Disabling the module makes the site behave again.
Downgrading to version 1.4 also fixes the site, but it's fairly useless as we're using webform 2.1.3

Message Not unique table/alias: 'n' query: SELECT DISTINCT(node.nid), node.sticky AS node_sticky, node.created AS node_created_created, node_data_field_blogimage.field_blogimage_fid AS node_data_field_blogimage_field_blogimage_fid, node_data_field_blogimage.field_blogimage_title AS node_data_field_blogimage_field_blogimage_title, node_data_field_blogimage.field_blogimage_alt AS node_data_field_blogimage_field_blogimage_alt, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN content_type_blog node_data_field_blogimage ON node.vid = node_data_field_blogimage.vid INNER JOIN node_access na ON na.nid = node.nid LEFT JOIN node n ON node.nid = n.nid LEFT JOIN node n ON node.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'workflow_access') OR (na.gid = 0 AND na.realm = 'workflow_access_owner') OR (na.gid = 0 AND na.realm = 'og_public'))) AND ((n.moderate != 1)) AND (n.type <> 'webform_report') AND ( (node.status = '1') AND (node.type IN ('blog')) AND (node.promote = '1') AND (node.moderate = '0') ) ORDER BY node_sticky DESC, node_created_created DESC in /scratch/home/test.midpenmedia.org/public_html/drupal-5.10/includes/database.mysqli.inc on line 154.

Comments

#1

Hi Steve, did you run update.php after installing the new version? If so, what versions of Drupal and mysql are you running?

#2

Sorry it's taken me so long to respond - I've been in Denver for the Dem Convention.

Yes, ran update.php

Using PHP 5.2.5 and Mysql 5.0.45, Drupal 5.10

#3

Also note - I'm having the same problem with 2.1 -- note that this ONLY seems to cause problems for non-authenticated users. People who are logged in are fine.

#4

Status:active» closed (fixed)

#5

Title:Version 2.0 completely breaks my web site» Version 2.5 completely breaks my web site
Version:5.x-2.0» 5.x-2.5

While this looks like an old issue, I installed Webform Report 5.x-2.5 today and got the "Not unique table/alias" error. The error only happens for anonymous users (while requesting any page) and the site layout was broken. Several blocks simply disappeared. Disabling the Webform Report module returned the website to a normal state.

My MAMP (version 1.8.2) installation did not produce these errors. Just the live site which is running the following:

Drupal 5.22
PHP 5.2.12
MySQL 5.0.89
Webform 5.x-2.9

#6

Status:closed (fixed)» needs review

Thanks for the feedback.

Try the attached patch - it looks like in hook_db_rewrite_sql(), it is adding to the sql statement:

        $return['where'] = "n.type <> 'webform_report'";

I'm not sure you can use <>, I think != is the correct operator.

        $return['where'] = "n.type != 'webform_report'";
AttachmentSize
297751.patch 702 bytes

#7

After a second look, it also looks like hook_db_rewrite_sql() is also adding an unnecessary join:

        if ($primary_table != 'n') {
          $return['join'] = "LEFT JOIN {node} n ON $primary_table.nid = n.nid";
        }

was changed to check for a primary table of 'node' as well

        if ($primary_table != 'n' && $primary_table != 'node') {
          $return['join'] = "LEFT JOIN {node} n ON $primary_table.nid = n.nid";
        }
AttachmentSize
297751-1.patch 898 bytes

#8

An updated patch is attached - based on feedback from a similar issue in the 6.x version. Any feedback from this patch would be appreciated.

AttachmentSize
297751-2.patch 1.93 KB

#9

Status:needs review» closed (fixed)