there is a tiny problem in translation.module in
translation_node_nid(...)
the sql string doesn't work with pgsql.
Inspite of using
'AND n.trid'
it'd be better to use
'AND n.trid is not null'

I replaced all the != with <> for compatibility as well.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jose Reyero’s picture

I'm not developing nor testing with pgsql so all fixes are welcomed.

But it seems you forgot to post the patch!

ivanSB@drupal.org’s picture

FileSize
3 KB

I just upgraded to 5.x-2.2 from 5.x-2.1 to test the patch on a newer version. Everything went smooth, no db change were required... and this is the patch...
I changed all the != to <>. Up to my knowledge while != is supported by pg too it is not part of sql92 standard. I wouldn't bet on it, but the change shouldn't (actually doesn't) hurt at all.

There are many != all around other files in the package... but since they didn't hurt for pg.... they are still there.

ivanSB@drupal.org’s picture

Priority: Normal » Critical
Status: Active » Needs review
FileSize
3 KB

Just updated to fix security problems and the issue is still there.
Here is the patch... same changes as before.

Jose Reyero’s picture

Status: Needs review » Fixed

Thanks

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

ekes’s picture

Title: postgres compatibility + patch » Translation lookup bug created by:- postgres compatibility + patch
Version: 5.x-2.1 » 5.x-2.5
Status: Closed (fixed) » Active
FileSize
1.51 KB

This patch added: AND n.trid is not null however the trid column in the tables {i18n_node} and {term_node} are trid int(10) unsigned NOT NULL default '0'. I guess that previously was relying on n.trid not being NULL or 0, because now the query joins trid n.trid 0 = a.trid 0 when there is no translation and returns a whole bunch of rows quite incorrectly.

Suggest replacing the line with for example for translation_node_nid:-

$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 > 0", $nid, $language ? $language : i18n_get_lang()));

I'm having a problem with cvs connection so a patch rolled against two local copies of translation.module on my machine is attached.

R.Hendel’s picture

Status: Active » Closed (won't fix)

Deprecated - D5 is no longer supported.