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.
Please, show the result of query SELECT * FROM contacts WHERE user_id = 1;
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 . .
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).
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;
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,