Taxonomy.admin.inc, row 282:

$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d'), $page_increment, 0, NULL, $vocabulary->vid);

I guess that it should be:

$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d', 't', 'tid'), $page_increment, 0, NULL, $vocabulary->vid);

Am I wrong?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

You are perfectly right. Please submit a patch!

bob_hirnlego’s picture

Status: Active » Needs review
FileSize
1.29 KB

Here it is... this is my first patch, hope that everything's fine.

catch’s picture

Version: 6.4 » 7.x-dev

Looks sane, not tested yet. Bumping to 7.x.

cdale’s picture

Version: 7.x-dev » 6.x-dev
FileSize
1.23 KB

I just experienced a warning due to this issue myself. I've changed it back to 6.x as I don't think this is relevant for 7.x anymore with the new hook_query_alter and all.

I've created a patch against 6.x that should correct this.

catch’s picture

This code is still in Drupal 7, but we're quite far from a point where hook_query_alter will take it over. I've left this at 6.x, but I've opened a Drupal 7 issue so it doesn't get lost there. #336849: Wrong $primary_field and $primary_table passed in db_rewrite_sql inside taxonomy_overview_terms()

cdale’s picture

Status: Needs review » Reviewed & tested by the community

I've been running the above patch for quite some time now, and I think it is simple enough, so marking as RTBC.

Gábor Hojtsy’s picture

Version: 6.x-dev » 7.x-dev

Looks good, committed to D6. I'd advocate committing this to D7 now, since it is a trivial patch. That would help us not loose this improvement in the shuffling between the new and old rewrite code.

Status: Reviewed & tested by the community » Needs work

The last submitted patch failed testing.

cdale’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.3 KB

New patch for D7.

Dries’s picture

Status: Reviewed & tested by the community » Needs work

We should have a test for this ...

cdale’s picture

How would I go about writing a test for this? I'm happy to attempt it, I just can't see how to go about it. And would it test just this specific db_rewrite? Or all of them?

catch’s picture

Version: 7.x-dev » 6.x-dev

Moving back to D6, where this doesn't need a test, since there's no db_rewrite_sql() in 7 now.

cdale’s picture

Status: Needs work » Fixed

This can be marked as fixed then, as it's already been committed to D6 in #7.

Status: Fixed » Closed (fixed)

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