Error in query: ... AND (q.aid IN (none)) ...

Starbuck - April 13, 2009 - 03:25
Project:Quotes
Version:6.x-1.x-dev
Component:Upgrading
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I had Quotes installed in v6.4 and just upgraded to v6.10. This is a test environment so it's possible something happened that's site-specific here but I'm documenting this in case it comes up elsewhere. On upgrading Drupal I also upgraded Quotes. The release ID is 6.x-1.x-dev. The prior version was from 2008-08-24 (according to quotes.info) and the current build is from 2009-03-15.

user warning: Unknown column 'none' in 'where clause' query: SELECT n.nid FROM quotes q INNER JOIN node n ON q.vid=n.vid WHERE n.status=1 AND n.type='quotes' AND q.promote = 1 AND (q.aid IN (none)) ORDER BY RAND() LIMIT 0, 1 in /home/.koontah/fatcat/portals/test01/sites/all/modules/quotes/quotes.module on line 1225.

The code that generates the query looks like this:

$query = 'SELECT n.nid FROM {quotes} q INNER JOIN {node} n ON q.vid=n.vid '
    . quotes_block_join_sql($filters)
    .'WHERE n.status='. (int)($filters['block_type'] != 2)  /* Type=2 is unpublished. */
    ." AND n.type='quotes' AND "
    . ($promoted_only ? ' q.promote = 1 AND ' : '')
    . quotes_block_where_sql($filters)
    .' ORDER BY '. ($filters['block_type'] == 0 ? 'RAND()' : 'n.created DESC');  /* Type=0 is random. */

The error is coming from quotes_block_where_sql from this statement:
if ($filters['aid_filter']) {
  $where[] = " (q.aid IN ($filters[aid_filter])) ";
}
It seems that somehow the author filter isn't defined but manages to get passed through the code even as "none". I'm not adept enough with PHP to see exactly how this is happening, sorry.

HTH

#1

vitzo.com - April 22, 2009 - 13:01

Same issue here.

#2

NancyDru - May 11, 2009 - 17:18
Status:active» postponed (maintainer needs more info)

Okay, I have to ask, did you run update.php?

#3

NancyDru - May 11, 2009 - 17:40
Status:postponed (maintainer needs more info)» active

Hmm, it looks like possibly the old version allowed 'None' to be selected in the author filter (which it should have, but doesn't now). The new code is not recognizing that as valid.

#4

NancyDru - May 11, 2009 - 20:44
Status:active» fixed

I just committed a fix (to 6.x-1.x-dev) that allows the block filters to be turned off, which I think is what you need to do.

#5

System Message - May 25, 2009 - 20:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.