If the Drupal database was installed with a prefix, as in my case where I added "intranet", the query below will break because there is no table called "term_node". It is, in my case, called "intranetterm_node".

* user warning: Table 'intranet.term_node' doesn't exist query: SELECT COUNT(*) FROM intranetnode WHERE status = 1 AND nid in (SELECT * FROM (SELECT DISTINCT nid FROM `term_node` WHERE tid in (4)) AS finalTable) in /var/www/html/intranet/includes/database.mysqli.inc on line 151.
    * user warning: Table 'intranet.term_node' doesn't exist query: SELECT nid FROM intranetnode WHERE status = 1 AND nid in (SELECT * FROM (SELECT DISTINCT nid FROM `term_node` WHERE tid in (4)) AS finalTable) LIMIT 0, 10 in /var/www/html/intranet/includes/database.mysqli.inc on line 151.

The actual SQL query is this one:

SELECT COUNT(*) 
FROM intranetnode 
WHERE status = 1 
AND nid in (SELECT * FROM (SELECT DISTINCT nid FROM `term_node` WHERE tid in (4)) 
AS finalTable);

Comments

alexh’s picture

I could fix that by changing line 252 to this:

    $sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, db_prefix_tables('{term_node}'));

But the autocomplete still does not work for me, don't know if this is related.

summit’s picture

Hi,

I could solve this by just changing:

 $sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, 'term_node');

to

 $sql = $sqlGenerator->generate($parser->ast, $tagTank->terms, '{term_node}');

So only adding {} was enough.

greetings,
Martijn

roychri’s picture

Status: Active » Fixed

I've committed the changes to the D5 branch and HEAD.

Thank you.

Status: Fixed » Closed (fixed)

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