Problem
- using pgSQL 9.x as database engine
- custom Drupal language with uppercase characters in machine language code e.g. ch-DE
- activating translation overview modul
On installation the module creates the database schema and is using the db_escape_table() version of the language code as field name in the translation_overview_priority table.
The function in translation_overview.module (which will be also called on installation)
function translation_overview_field_name($lang_code) {
return 'lang_' . db_escape_table($lang_code);
}
returns e.g. for the lang_code 'ch-DE' -> 'chDE'
But on creation of the scheme Drupal lowercase the field name to 'chde' and after that the creation of the INDEX fails with the following error:
PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column "chDE" does not exist: CREATE INDEX "translation_overview_priority_chDE_idx" ON {translation_overview_priority} ("chDE"); Array ( ) in db_create_table() (line 2688 of /var/www/clients/client1/web19/web/includes/database/database.inc).
Because in the pgSQL table the field is named "chde" instead!
Proposed resolution
So a workaround / fix could be lowercasing the escaped language code in the central translation_overview_field_name() function like so:
function translation_overview_field_name($lang_code) {
return 'lang_' . strtolower(db_escape_table($lang_code));
}
After that the installation runs fine and the module seems to work.
Comments
Comment #1
maartendeblock CreditAttribution: maartendeblock commentedThis issue still exists in the current version. The proposed workaround works for us.
Comment #2
stefan.r CreditAttribution: stefan.r commentedDoesn't this need an update hook first?