Since I upgraded to Drupal 5.2 and i18n-5.x-2.1 from Drupal 4.7 and i18n-4.7.x-1.0, I have these messages rolling in my site logs:

pg_query(): Query failed: ERROR: argument of AND must be type boolean, not type integer in database.pgsql.inc on line 125.

query: SELECT n.nid FROM i18n_node n INNER JOIN i18n_node a ON n.trid = a.trid AND n.nid != a.nid WHERE a.nid = 520 AND n.language = 'fr' AND n.trid in database.pgsql.inc on line 144.

Comments

flodemo’s picture

I have a fresh install of Drupal 5.2 and i18n-5.x-2.1 and when I activate the i18n module with the tutorial "Basic site set up" . I have the same error.

Notes that my database is a PGSQL database.

The complet error message that appear on each page is :

    <ul>
  <li>warning: pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR:  argument of AND must be type boolean, not type integer in /mnt/144/sdb/e/3/amacse/includes/database.pgsql.inc on line 125.</li>
  <li>user warning: 
query: SELECT n.nid FROM drup_i18n_node n INNER JOIN drup_i18n_node a ON n.trid = a.trid AND n.nid != a.nid WHERE a.nid = 24 AND n.language = &#039;en&#039; AND n.trid in /mnt/144/sdb/e/3/amacse/includes/database.pgsql.inc on line 144.</li>
  <li>warning: pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR:  argument of AND must be type boolean, not type integer in /mnt/144/sdb/e/3/amacse/includes/database.pgsql.inc on line 125.</li>
  <li>user warning: 
query: SELECT n.nid FROM drup_i18n_node n INNER JOIN drup_i18n_node a ON n.trid = a.trid AND n.nid != a.nid WHERE a.nid = 24 AND n.language = &#039;fr&#039; AND n.trid in /mnt/144/sdb/e/3/amacse/includes/database.pgsql.inc on line 144.</li>
 </ul>

Thank you for any help in order to solve this problem.

klance’s picture

This query is on line 982 of i18n/translation/translation.module:

function translation_node_nid($nid, $language = NULL, $default = NULL) {
  $translation = db_result(db_query("SELECT n.nid FROM {i18n_node} n INNER JOIN {i18n_node} a ON n.trid = a.trid AND n.nid != a.nid WHERE a.nid = %d AND n.language = '%s' AND n.trid", $nid, $language ? $language : i18n_get_lang()));
  return $translation ? $translation : $default;
}

I only had a quick look at it, and the only thing I thought was a bit odd is that it ends with "AND n.trid". So I removed that, cleared the logs, and the errors went away. I'm not saying I solved the problem by any means, but I'm not aware of implicit comparisons like this existing in SQL, so that's all I can add for the moment.

klance’s picture

I'm going to change this last bit to "AND n.trid != 0" for now, because that gets rid of the error log entries and accomplishes what I think this query is trying to do implicitly. The column trid in i18n_node is set to NOT NULL DEFAULT '0', so zero is the only false/invalid value it can have.

R.Hendel’s picture

Status: Active » Closed (won't fix)

Deprecated - D5 is no longer supported.