Warning: The author of this contribution does not provide support for it anymore.

User Reminder

index name too long error - User Reminder

index name too long error

by 5hocK » Sat Oct 06, 2012 11:34 am

After running the install, this error appears. Is it maybe because it's not compatable with phpbb3.0.11 or is there a way of altering the maximum number of characters allowed?

Code: Select all

Index name 'XXXphpbb_users_user_reminder_inactive' on table 'XXXphpbb_users' is too long. The maximum is 33 characters.

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/db/db_tools.php
LINE: 2141
CALL: trigger_error()

FILE: [ROOT]/install/index.php
LINE: 143
CALL: phpbb_db_tools->sql_create_index()


Thanks
5hocK
Registered User
Posts: 3139
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK
Contact:

Re: index name too long error

by Oyabun1 » Sat Oct 06, 2012 12:06 pm

If you don't use a Firebird database this should work.

Open /includes/db/db_tools.php

Find

Code: Select all

   function sql_create_unique_index($table_name, $index_name, $column)
   {
      $statements = array();

      $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
      if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
      {
         $max_length = strlen($table_prefix) + 24;
         trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
      }
Replace with

Code: Select all

   function sql_create_unique_index($table_name, $index_name, $column)
   {

      $statements = array();
      if ($this->sql_layer == 'firebird')
      {
      $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
      if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
      {
         $max_length = strlen($table_prefix) + 24;
            trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The Firebird maximum is $max_length characters.", E_USER_ERROR);
         }
      }

Find

Code: Select all

   function sql_create_index($table_name, $index_name, $column)
   {
      $statements = array();

      $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
      if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
      {
         $max_length = strlen($table_prefix) + 24;
         trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
      }
Replace with

Code: Select all

   function sql_create_index($table_name, $index_name, $column)
   {
      $statements = array();
      if ($this->sql_layer == 'firebird')
      {
      $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
      if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
      {
         $max_length = strlen($table_prefix) + 24;
         trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
      }
      }
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill
Contact:

Re: index name too long error

by 5hocK » Sat Oct 06, 2012 1:36 pm

After those changes and running the installer to uninstall and then re -install I get this error

Code: Select all

SQL ERROR [ mysqli ]

Duplicate entry '0' for key 3 [1062]

SQL

ALTER TABLE XXXphpbb_users ADD UNIQUE INDEX user_reminder_inactive(user_reminder_inactive)

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/db/dbal.php
LINE: 757
CALL: trigger_error()

FILE: [ROOT]/includes/db/mysqli.php
LINE: 182
CALL: dbal->sql_error()

FILE: [ROOT]/includes/db/db_tools.php
LINE: 1441
CALL: dbal_mysqli->sql_query()

FILE: [ROOT]/includes/db/db_tools.php
LINE: 2128
CALL: phpbb_db_tools->_sql_run_sql()

FILE: [ROOT]/install/index.php
LINE: 143
CALL: phpbb_db_tools->sql_create_index()


I've retried by manually removing the tables in database aswell but get the same error when trying to install. Tables I removed were these 4 - http://imageshack.us/a/img690/5557/userreminder.png

db_tools.zip
(12.26 KiB) Downloaded 224 times

Thanks for your time.

EDIT: MySQL version is 5.0.96-community
5hocK
Registered User
Posts: 3139
Joined: Wed Nov 23, 2011 7:00 pm
Location: UK
Contact:

Re: index name too long error

by iamthestreets » Mon Oct 08, 2012 4:26 pm

did you fix this issue and how?
iamthestreets
Registered User
Posts: 244
Joined: Fri Feb 24, 2012 4:35 pm
Contact:

Re: index name too long error

by Oyabun1 » Mon Oct 08, 2012 9:11 pm

5hocK wrote:I've retried by manually removing the tables in database aswell but get the same error when trying to install. Tables I removed were these 4 - http://imageshack.us/a/img690/5557/userreminder.png
They're columns, not tables. How did you remove them?

The error seems to indicate that the indexes for those columns already exist. If you used the MySQL DROP statement to remove the columns then the indexes should have been automatically removed. (The MOD's install file seems to use the standard phpBB database functions which remove columns by dropping them, so I'm not sure why the index exists.)
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill
Contact:

Re: index name too long error

by AngelM » Sun Nov 04, 2012 3:58 am

I just tried to install this arcade mod and get the error too. Since I am totally new to modding, any help would be appreciated.

Thanks,

Angel

General Error
Index name 'user_arcade_last_search_term_gen' on table 'phpbb_arcade_users' is too long. The maximum auto increment column length is 26 characters.

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/db/db_tools.php
LINE: 482
CALL: trigger_error()

FILE: [ROOT]/install/install_install.php
LINE: 93
CALL: phpbb_db_tools->sql_create_table()

FILE: [ROOT]/install/install_install.php
LINE: 74
CALL: install_install->install()

FILE: [ROOT]/install/index.php
LINE: 273
CALL: install_install->main()

FILE: [ROOT]/install/index.php
LINE: 122
CALL: module->load()
User avatar
AngelM
Registered User
Posts: 77
Joined: Tue Oct 30, 2012 6:30 am
Location: UT
Name: Angel
Contact:

Re: index name too long error

by Oyabun1 » Sun Nov 04, 2012 4:04 am

AngelM wrote:I just tried to install this arcade mod and get the error too.
This is not an Arcade MOD, so your error has nothing to do with this MOD.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill
Contact:

Re: index name too long error

by AngelM » Sun Nov 04, 2012 4:32 am

Oh okay. So do you know where I would ask this question? Very confusing here with tons and tons of forums. I did try looking but unsure where to post.

Thank you,

Angel
User avatar
AngelM
Registered User
Posts: 77
Joined: Tue Oct 30, 2012 6:30 am
Location: UT
Name: Angel
Contact:

Re: index name too long error

by Oyabun1 » Sun Nov 04, 2012 4:50 am

Wherever you got whatever Arcade MOD is throwing the error.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill
Contact: