Author Topic: Errors with indexcontacts.sh on 0.7 stable  (Read 3111 times)

Offline philip_rhoades

  • Jr. Member
  • **
  • Posts: 28
Errors with indexcontacts.sh on 0.7 stable
« on: January 02, 2012, 05:58:36 AM »
People,

This problem started with 0.6rc but seems to have gotten worse with recent versions (0.6svn, 0.7).  Recently added contacts were not appearing as selectable in the To; field.  I was advised to run the indexcontacts.sh script but got the errors below  (User 1 - me - has over 1,000 contacts):

Indexing contacts for user 3...done.
Indexing contacts for user 2...done.
Indexing contacts for user 1...DB Error in /home/ssl/roundcubemail-0.7/program/include/rcube_mdb2.php (293): prepare: [Error message: Unable to cr
eate prepared statement handle]

[Last executed query: DEALLOCATE PREPARE mdb2_statement_pgsql_6f07e825cdc3270409b16256b0161a192ab4fe9e7]

[Native message: ERROR:  value too long for type character varying(255)]


DB Error in  . . .

How to fix?

Thanks,

Phil.

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Errors with indexcontacts.sh on 0.7 stable
« Reply #1 on: January 02, 2012, 01:13:42 PM »
Please, show the result of query SELECT * FROM contacts WHERE user_id = 1;

Offline philip_rhoades

  • Jr. Member
  • **
  • Posts: 28
Errors with indexcontacts.sh on 0.7 stable
« Reply #2 on: January 02, 2012, 01:19:18 PM »
That select works of course but what is your point?  There are two reasons not to put the output here - there are more than a thousand contacts and privacy . .

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Errors with indexcontacts.sh on 0.7 stable
« Reply #3 on: January 02, 2012, 01:29:54 PM »
The update query works for user 3 and 2, but not for 1, so maybe it's data-specific issue. As for the error. There's only one column in contacts table with 255 characters limit. It's email column. You can also add print_r($write_sql); in line 658 of include/rcube_contacts.php file (inside update() method). This will print data of every contact. Just check the last one (just before the error).

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Errors with indexcontacts.sh on 0.7 stable
« Reply #4 on: January 02, 2012, 01:34:31 PM »
After writing this I found what the issue can be. Now we're storing many emails in one database field. It's possible that the string is too long when contact has a few addresses assigned. I think we should change the column length. ALTER contacts ALTER email TYPE text;

Offline philip_rhoades

  • Jr. Member
  • **
  • Posts: 28
Errors with indexcontacts.sh on 0.7 stable
« Reply #5 on: January 02, 2012, 01:41:42 PM »
Well done!  Users 2 & 3 are only very occasional users and have none or few contacts.  On PostgreSQL the command was:

ALTER TABLE contacts ALTER email TYPE text;

but it worked!

CORRECTION - I spoke too soon - the REINDEX seems to work now but added new contacts still do not show up - I did it twice just to be sure . .

There is something odd here - trying to REadd a contact sometimes gives an error about the contact already existing but it can't be found with a SELECT command . .

Also, why are there 60+ copies of the same email address in some contact email fields?

Thanks,

Phil,
« Last Edit: January 02, 2012, 02:23:20 PM by philip_rhoades »