Problem/Motivation

The MySQL limit for INT is 4294967295 (https://dev.mysql.com/doc/refman/5.7/en/integer-types.html)
The PHP (int) data conversion limit is platform-dependent (see http://can handle this changephp.net/manual/en/language.types.integer.php), but can be much higher.

While trying to translate certain blocks the following error can be encountered when clicking the "Save and Translate" button on the block edit form page: -

PDOException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'objectindex' at row 1: .....

Proposed resolution

Change the data type of objectindex to BIGINT

Remaining tasks

Patch the .install file to change the schema and add a hook_update_n to change existing schemas.

Data model changes

Change the data type of objectindex to BIGINT

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dubs’s picture

Issue summary: View changes
Dubs’s picture

Version: 7.x-1.10 » 7.x-1.x-dev

Updating issue tags...

Dubs’s picture

Issue summary: View changes
Dubs’s picture

Issue summary: View changes
Dubs’s picture

Dubs’s picture

nightlife2008’s picture

Hi,
I have a similar issue when doing a site install where I i18n-string import some panel-related strings, where the i18n_string module also returns an error.

After some debugging and inspecting the DB, it seems that i18n_string converts the panels UUID in "objectid" into an integer to fill in the "objectkey".

protected function save_string($string, $update = FALSE) {
    if (!$string->get_source()) {
      // Create source string so we get an lid
      $this->save_source($string);
    }
    if (!isset($string->objectkey)) {
      $string->objectkey = (int)$string->objectid; <----- UUID to INT goes wrong.
    }
    if (!isset($string->format)) {
      $string->format = '';
    }

    $status = db_merge('i18n_string')
      ->key(array('lid' => $string->lid))
      ->fields(array(
          'textgroup' => $string->textgroup,
          'context' => $string->context,
          'objectid' => $string->objectid,
          'type' => $string->type,
          'property' => $string->property,
          'objectindex' => $string->objectkey,
          'format' => $string->format,
      ))
      ->execute();
    return $status;
  }

I updated the module with a rather weak patch to set the "objectkey" to 0 in case of UUID type strings to solve my problem, but I think there should be better ways to improve this.

nightlife2008’s picture

GiorgosK’s picture

making the objectindex from int to bigint solves the problem

Dubs’s picture

@GiorgosK - agreed - it should be easy to patch the install file for this. I should probably do this when I have time!

attiks’s picture

Status: Active » Needs review
FileSize
1.98 KB

Patch based on #8

- update column objectindex to bigint
- check if objectid is numeric before converting to objectkey
- make sure objectkey is numeric before saving

Status: Needs review » Needs work

The last submitted patch, 11: i2200647-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Ivan Berezhnov’s picture

- update column objectindex length to 20.
Please review my patch.

Ivan Berezhnov’s picture

FileSize
2.03 KB

- update column objectindex length to 20.
Please review my second patch.

Ivan Berezhnov’s picture

FileSize
1.55 KB

Fixed problem in the class.

Ivan Berezhnov’s picture

Status: Needs work » Needs review
attiks’s picture

Status: Needs review » Reviewed & tested by the community

#15 Nice catch thanks for rerolling

joseph.olstad’s picture

Issue summary: View changes

Anyone willing to RTBC this patch under oath that it's regression free?

Will this work with postgresql as well?
I imagine the abastraction layer takes care of this to make it compatible with Postgresql using it's driver and mssql using the sqlsrv driver

attiks’s picture

#18 I ran this on Postgres without a problem

joseph.olstad’s picture

ok, I'll commit this to 7.x-1.x-dev sometime soon thanks.

joseph.olstad’s picture

Thanks again for all the hard work. Without having actually tested it, just reviewing the code visually, the patch looks really well written.

Ivan Berezhnov’s picture

Yahooo
"ok, I'll commit this to 7.x-1.x-dev sometime soon thanks."
@joseph.olstad Thanks )))

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

fixed in 7.x-1.x dev

Please try to break this asap.

We should plan to release this in 2 weeks.
'release' meaning, tag a new release of i18n in 2 weeks.

unless of course someone objects.

Status: Fixed » Closed (fixed)

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

joseph.olstad’s picture

released in 7.x-1.22

joseph.olstad’s picture

There have been reports of regressions.

#2926290: Database schema inconsistent i18n_string table on clean install i18n module.

I have not seen this myself however enough people have raised issues to make it a valid concern. Trying to determine what versions of database servers and what type of database server (MySQL vX.X / Postgresql X.X / MSSQL Server x.x / sqlite version X, etc)

looking for the version info

followup in

#2926290: Database schema inconsistent i18n_string table on clean install i18n module.