Today I had occasion to use hook_db_rewrite_sql to add a table join with no where conditions.

With no 'where' return array element defined, the WHERE key word was not inserted. With a blank 'where' element, the WHERE key word was added but with a blank condition. ie. '()'. All invalid SQL. So I used a condition of '1'.

This may sound like a strange thing to do, but it's quite valid to introduce a new table to get the join to cut down the result set. The 'where' return array element should not need to exist.

Comments

mot’s picture

Status: Active » Closed (fixed)

Closed because of no activity since a long time.