diff -urpN prepatch-0807/includes/bootstrap.inc drupal-6.x-dev-db2-0.2/includes/bootstrap.inc
--- prepatch-0807/includes/bootstrap.inc	2007-07-31 03:22:47.000000000 +0800
+++ drupal-6.x-dev-db2-0.2/includes/bootstrap.inc	2007-08-07 01:30:40.000000000 +0800
@@ -822,7 +822,7 @@ function drupal_is_denied($type, $mask) 
   // (allowed).
   // The use of ORDER BY / LIMIT is more efficient than "MAX(status) = 0"
   // in PostgreSQL <= 8.0.
-  return (bool) db_result(db_query_range("SELECT CASE WHEN status=1 THEN 0 ELSE 1 END FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) ORDER BY status DESC", $type, $mask, 0, 1));
+  return (bool) db_result(db_query_range("SELECT CASE WHEN status=1 THEN 0 ELSE 1 END FROM {access} WHERE type = '%s' AND LOWER(mask) LIKE LOWER('%s') ORDER BY status DESC", $type, $mask, 0, 1));
 }
 
 /**

diff -urpN prepatch-0807/modules/taxonomy/taxonomy.module drupal-6.x-dev-db2-0.2/modules/taxonomy/taxonomy.module
--- prepatch-0807/modules/taxonomy/taxonomy.module	2007-08-07 01:18:43.000000000 +0800
+++ drupal-6.x-dev-db2-0.2/modules/taxonomy/taxonomy.module	2007-08-07 15:53:33.000000000 +0800
@@ -821,7 +821,7 @@ function _taxonomy_term_children($tid) {
  *   An array of matching term objects.
  */
 function taxonomy_get_term_by_name($name) {
-  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER('%s') LIKE LOWER(t.name)", 't', 'tid'), trim($name));
+  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER(t.name) LIKE LOWER('%s')", 't', 'tid'), trim($name));
   $result = array();
   while ($term = db_fetch_object($db_result)) {
     $result[] = $term;
