<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>IMAP Client issues / Wrong SQL statement?</title> 
  <pubDate>Fri, 10 Apr 2026 07:55:33 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/12979</link> 
  <atom:link rel="self" type="application/rss+xml" title="IMAP Client issues / Wrong SQL statement?" href="https://bugs.horde.org/ticket/12979/rss" /> 
  <description>IMAP Client issues / Wrong SQL statement?</description> 
 
   
   
  <item> 
   <title>When moving a message with IMP on my IMAP-Server from INBOX </title> 
   <description>When moving a message with IMP on my IMAP-Server from INBOX to Folder.Subfolder I receive the following error (attachment) and also the following log entry is issued.

2014-02-18T13:16:23+01:00 ERR: HORDE [imp] SQL QUERY FAILED: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry &#039;0&#039; for key &#039;PRIMARY&#039;  
        INSERT INTO horde_imap_client_data (hostspec, mailbox, port, username)
          VALUES (&#039;localhost&#039;, &#039;Folder.Subfolder&#039;, &#039;143&#039;,
          &#039;user@domain.com&#039;) [pid 16977 on line 553 of &quot;/usr/share/php/Horde/Db/Adapter/Base.php&quot;

There is a messageid field in the horde_imap_client_data table which is set to 0 already for &quot;Folder&quot;. Other folders have other numbers.

Also, when looking at the folder (e.g. click to show content), I just see nothing/empty folder.
However, for other (older) IMAP-Folders everything works perfectely.

What could be the reason for this?! DB out of date/not properly updated?

Thanks for any pointers/fixes.

</description> 
   <pubDate>Tue, 18 Feb 2014 12:33:07 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82409</link> 
  </item> 
   
  <item> 
   <title>This was changed by this commit:

commit f47da21798ffc4d16</title> 
   <description>This was changed by this commit:

commit f47da21798ffc4d1664e167a620ca846c2808ff6
Author: Jan Schneider &lt;jan@horde.org&gt;
Date:   Tue Feb 11 23:06:14 2014 +0100

    Rename uid column to messageid.

    uid is a reserved word on Oracle databases.</description> 
   <pubDate>Wed, 19 Feb 2014 06:56:43 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82414</link> 
  </item> 
   
  <item> 
   <title>But I _do_ have the column &#039;messageid&#039; and no column &#039;uid&#039; i</title> 
   <description>But I _do_ have the column &#039;messageid&#039; and no column &#039;uid&#039; in table &#039;horde_imap_client_data&#039; !?

Also, my running codebase shows in file 1_horde_imap_client_base_tables.php &#039;messageid&#039; as autoincrementKey.

BTW: I can move messages to older folders. But when creating a folder, it seems that the appropriate enrtry cannot be made into table &#039;horde_imap_client_data&#039;.

Further ideas to investigate on this one?
</description> 
   <pubDate>Wed, 19 Feb 2014 09:18:02 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82415</link> 
  </item> 
   
  <item> 
   <title>Sounds like your messageid column is not an autoincrement co</title> 
   <description>Sounds like your messageid column is not an autoincrement column (anymore?). What database do you use, and has this been migrated from an earlier version of the Horde_Imap_Client database schema?</description> 
   <pubDate>Wed, 19 Feb 2014 10:36:01 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82416</link> 
  </item> 
   
  <item> 
   <title>And are you really using FRAMEWORK_5_1 code?</title> 
   <description>And are you really using FRAMEWORK_5_1 code?</description> 
   <pubDate>Wed, 19 Feb 2014 10:36:35 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82417</link> 
  </item> 
   
  <item> 
   <title>I am using MySQL - and yes, I assume it has been migrated fr</title> 
   <description>I am using MySQL - and yes, I assume it has been migrated from an earlier version. (I am using Debian sid/experimental packages and at some point imap_client came into the game)

--
-- Table structure for table `horde_imap_client_data`
--
CREATE TABLE IF NOT EXISTS `horde_imap_client_data` (
  `messageid` int(10) unsigned NOT NULL DEFAULT &#039;0&#039;,
  `hostspec` varchar(255) NOT NULL,
  `mailbox` varchar(255) NOT NULL,
  `modified` bigint(20) DEFAULT NULL,
  `port` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  PRIMARY KEY (`messageid`),
  KEY `index_horde_imap_client_data_on_hostspec_and_mailbox_and_port_an` (`hostspec`,`mailbox`,`port`,`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

So I assume, the autoincrement got lost at some point...

&gt; Sounds like your messageid column is not an autoincrement column 
&gt; (anymore?). What database do you use, and has this been migrated from 
&gt; an earlier version of the Horde_Imap_Client database schema?
</description> 
   <pubDate>Wed, 19 Feb 2014 10:44:20 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82418</link> 
  </item> 
   
  <item> 
   <title>&gt; And are you really using FRAMEWORK_5_1 code?

I was assu</title> 
   <description>&gt; And are you really using FRAMEWORK_5_1 code?

I was assuming so, since Horde says in the upper left, that version is &quot;5.1.5&quot;.

Unfortunately, checking for newer versions under adminstration does not work anymore... (but this ought to be another story)

Thanks!</description> 
   <pubDate>Wed, 19 Feb 2014 10:46:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82419</link> 
  </item> 
   
  <item> 
   <title>I don&#039;t know, if during migration the table has been altered</title> 
   <description>I don&#039;t know, if during migration the table has been altered to add the auto_increment feature.

I tried to do so manually and it caused a hick-up due to an entry with &#039;0&#039; as messageid, thus setting the auto-increment sequence to 1 and having a PRIMARY violation. Setting this record to anything &gt; 0 will make the table alteration successful.

&gt; I am using MySQL - and yes, I assume it has been migrated from an 
&gt; earlier version. (I am using Debian sid/experimental packages and at 
&gt; some point imap_client came into the game)
&gt;
&gt; --
&gt; -- Table structure for table `horde_imap_client_data`
&gt; --
&gt; CREATE TABLE IF NOT EXISTS `horde_imap_client_data` (
&gt;   `messageid` int(10) unsigned NOT NULL DEFAULT &#039;0&#039;,
&gt;   `hostspec` varchar(255) NOT NULL,
&gt;   `mailbox` varchar(255) NOT NULL,
&gt;   `modified` bigint(20) DEFAULT NULL,
&gt;   `port` int(11) NOT NULL,
&gt;   `username` varchar(255) NOT NULL,
&gt;   PRIMARY KEY (`messageid`),
&gt;   KEY 
&gt; `index_horde_imap_client_data_on_hostspec_and_mailbox_and_port_an` 
&gt; (`hostspec`,`mailbox`,`port`,`username`)
&gt; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
&gt;
&gt; So I assume, the autoincrement got lost at some point...
&gt;
&gt;&gt; Sounds like your messageid column is not an autoincrement column
&gt;&gt; (anymore?). What database do you use, and has this been migrated from
&gt;&gt; an earlier version of the Horde_Imap_Client database schema?
&gt;
</description> 
   <pubDate>Wed, 19 Feb 2014 13:03:39 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82420</link> 
  </item> 
   
  <item> 
   <title>So, did you install the original horde_imap_client version t</title> 
   <description>So, did you install the original horde_imap_client version through apt/dpkg and then upgraded via PEAR?
Do you remember the versions of that library before and after the upgrade?
It starts to sound like a botched upgrade rather than a design issue of the migration scripts.</description> 
   <pubDate>Wed, 19 Feb 2014 13:20:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82421</link> 
  </item> 
   
  <item> 
   <title>Always via official debian repository (though sid/experiment</title> 
   <description>Always via official debian repository (though sid/experimental).
(I used to have a PEAR installation way before...)

&gt; So, did you install the original horde_imap_client version through 
&gt; apt/dpkg and then upgraded via PEAR?
&gt; Do you remember the versions of that library before and after the upgrade?
&gt; It starts to sound like a botched upgrade rather than a design issue 
&gt; of the migration scripts.
</description> 
   <pubDate>Wed, 19 Feb 2014 13:28:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t82422</link> 
  </item> 
   
  <item> 
   <title>&gt; Always via official debian repository (though sid/experime</title> 
   <description>&gt; Always via official debian repository (though sid/experimental).
&gt; (I used to have a PEAR installation way before...)
&gt;
&gt;&gt; So, did you install the original horde_imap_client version through
&gt;&gt; apt/dpkg and then upgraded via PEAR?
&gt;&gt; Do you remember the versions of that library before and after the upgrade?
&gt;&gt; It starts to sound like a botched upgrade rather than a design issue
&gt;&gt; of the migration scripts.
&gt;
Hello,
i got the same problem, after upgrade horde 2 weeks ago by pear. 
Here is my database structure (there is no autoincremet option i messageid column):

mysql&gt; DESCRIBE horde_imap_client_data;
+-----------+------------------+------+-----+---------+-------+
| Field     | Type             | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| messageid | int(10) unsigned | NO   | PRI | 0       |       |
| hostspec  | varchar(255)     | NO   | MUL | NULL    |       |
| mailbox   | varchar(255)     | NO   |     | NULL    |       |
| modified  | bigint(20)       | YES  |     | NULL    |       |
| port      | int(11)          | NO   |     | NULL    |       |
| username  | varchar(255)     | NO   |     | NULL    |       |
+-----------+------------------+------+-----+---------+-------+
6 rows in set (0.00 sec)

New users can&#039;t log to webmail. 
He is error from my log file 

Apr 28 09:26:18 hostname HORDE: [imp] SQL QUERY FAILED: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry &#039;0&#039; for key &#039;PRIMARY&#039;  #012#011INSERT INTO horde_imap_client_data (hostspec, mailbox, port, username)#012#011  VALUES (&#039;host&#039;, &#039;INBOX&#039;, &#039;143&#039;, &#039;username@domain&#039;) [pid 9236 on line 204 of &quot;/usr/share/pear/Horde/Db/Adapter/Pdo/Base.php&quot;]

How can i fix the problem?
</description> 
   <pubDate>Mon, 28 Apr 2014 07:46:57 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t83473</link> 
  </item> 
   
  <item> 
   <title>http://lists.horde.org/archives/imp/Week-of-Mon-20140310/055</title> 
   <description>http://lists.horde.org/archives/imp/Week-of-Mon-20140310/055939.html</description> 
   <pubDate>Mon, 28 Apr 2014 08:23:39 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/12979#t83474</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
