Bug #12339 insert ... select ... produces duplicate key.
Submitted: 3 Aug 2005 8:17 Modified: 4 Aug 2005 9:08
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.10a (Innodb) OS:Windows (Win XP)
Assigned to: CPU Architecture:Any

[3 Aug 2005 8:17] [ name withheld ]
Description:
While testing MySQL with "jakarta slide" I've detected the following with the MySQL41RDBMSAdapter. Working well with Mysql 4.1 but with MySQL 5 it produces the following error:

   Duplicate entry '1-DAV:-modificationdate' for key 1

when inserting properties by a prepared "insert ... " with a joined "select"

How to repeat:
Create a new innodb database and setup a slide environment. During first installation the function "createRevisionDescriptor" will be executed

statement = connection
              .prepareStatement("insert into PROPERTIES (VERSION_ID,PROPERTY_NAMESPACE,PROPERTY_NAME,PROPERTY_VALUE,PROPERTY_TYPE,IS_PROTECTED) select vh.VERSION_ID, ?, ?, ?, ?, ? from VERSION_HISTORY vh, URI u where vh.URI_ID = u.URI_ID and u.URI_STRING = ? and vh.REVISION_NO = ?");

this fails with the above error.
[4 Aug 2005 7:11] Vasily Kishkin
Could you please provide table definitions (PROPERTIES,VERSION_HISTORY), example values and simple test case.
[4 Aug 2005 9:08] [ name withheld ]
After creating a log file the reason seems to be Bug #12340. 

Because Slide is doing a lot of setup stuff during first execution it is a little bit  complicated to see the reason, but in the created log file there are first sucessful inserts then the multitable delete, then a new insert which fails.

Sorry for reporting this, but this was the first thing I've detected. So let us look forward what happens after solving #12340.