When called from node.module in node_load, db_rewrite_sql adds the clause '(created > (sometimestamp)) and between the beginning of the query and the additional $cond.

However, in the queries performed in this function, "created" is ambiguous, and MySQL (4.0.17-standard-log) chokes on it with error : #1052 - Column: 'created' in where clause is ambiguous

This prevents any node from being displayed in these configurations.

In this request's case, the added clause should read '(n.created > (sometimestamp)) and (or possibly '(r.created > (sometimestamp)) and , as I haven't looked into the new node_revisions logic yet). Using n.created works.

However, blankly prefixing created with "n." or "r." could probably wreak havoc elsewhere.

Comments

chx’s picture

Assigned: Unassigned » chx
Priority: Critical » Normal
Status: Active » Closed (won't fix)

db_rewrite_sql does not add anything like that. In fact, without contrib modules db_rewrite_sql does not change any query.

fgm’s picture

Status: Closed (won't fix) » Closed (fixed)

Found it: the bug is actually not in db_rewrite_sql or _db_rewrite_sql, but is generated in _db_rewrite_sql from an error in another module when it invokes each hook_db_rewrite_sql in turn.

Thanks for suggesting the " without contrib modules" point, which helped me localize it.