Program: 150520
Project: 150520
Buggy source:
@Test public void testMerge() throws Exception {
switch (getDialect()) {
case ASE:
case DERBY:
case H2:
case INGRES:
case MYSQL:
case POSTGRES:
case SQLITE:
    log.info("String_Node_Str","String_Node_Str");
  return;
}
jOOQAbstractTest.reset=false;
create().mergeInto(TAuthor()).using(create().selectOne()).on("String_Node_Str").whenMatchedThenUpdate().set(TAuthor_FIRST_NAME(),"String_Node_Str").whenNotMatchedThenInsert(TAuthor_ID(),TAuthor_LAST_NAME()).values(3,"String_Node_Str").execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
create().mergeInto(TAuthor()).using(create().selectOne()).on(TAuthor_ID().equal(1)).whenMatchedThenUpdate().set(TAuthor_FIRST_NAME(),"String_Node_Str").whenNotMatchedThenInsert(TAuthor_ID(),TAuthor_LAST_NAME()).values(3,"String_Node_Str").execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
Field<String> f=val("String_Node_Str").as("String_Node_Str");
Field<String> l=val("String_Node_Str").as("String_Node_Str");
MergeFinalStep<A> q=create().mergeInto(TAuthor()).using(create().select(f,l)).on(TAuthor_LAST_NAME().equal(l)).whenMatchedThenUpdate().set(TAuthor_FIRST_NAME(),"String_Node_Str").whenNotMatchedThenInsert().set(TAuthor_ID(),3).set(TAuthor_FIRST_NAME(),f).set(TAuthor_LAST_NAME(),l);
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
f=val("String_Node_Str").as("String_Node_Str");
l=val("String_Node_Str").as("String_Node_Str");
q=create().mergeInto(TAuthor()).using(create().select(f,l)).on(TAuthor_LAST_NAME().equal(l)).whenNotMatchedThenInsert(TAuthor_ID(),TAuthor_FIRST_NAME(),TAuthor_LAST_NAME(),TAuthor_DATE_OF_BIRTH()).values("String_Node_Str",f,l,0L);
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
}

Fixed version (ground truth):
@Test public void testMerge() throws Exception {
switch (getDialect()) {
case ASE:
case CUBRID:
case DERBY:
case H2:
case INGRES:
case MYSQL:
case POSTGRES:
case SQLITE:
    log.info("String_Node_Str","String_Node_Str");
  return;
}
jOOQAbstractTest.reset=false;
create().mergeInto(TAuthor()).using(create().selectOne()).on("String_Node_Str").whenMatchedThenUpdate().set(TAuthor_FIRST_NAME(),"String_Node_Str").whenNotMatchedThenInsert(TAuthor_ID(),TAuthor_LAST_NAME()).values(3,"String_Node_Str").execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
create().mergeInto(TAuthor()).using(create().selectOne()).on(TAuthor_ID().equal(1)).whenMatchedThenUpdate().set(TAuthor_FIRST_NAME(),"String_Node_Str").whenNotMatchedThenInsert(TAuthor_ID(),TAuthor_LAST_NAME()).values(3,"String_Node_Str").execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
Field<String> f=val("String_Node_Str").as("String_Node_Str");
Field<String> l=val("String_Node_Str").as("String_Node_Str");
MergeFinalStep<A> q=create().mergeInto(TAuthor()).using(create().select(f,l)).on(TAuthor_LAST_NAME().equal(l)).whenMatchedThenUpdate().set(TAuthor_FIRST_NAME(),"String_Node_Str").whenNotMatchedThenInsert().set(TAuthor_ID(),3).set(TAuthor_FIRST_NAME(),f).set(TAuthor_LAST_NAME(),l);
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
f=val("String_Node_Str").as("String_Node_Str");
l=val("String_Node_Str").as("String_Node_Str");
q=create().mergeInto(TAuthor()).using(create().select(f,l)).on(TAuthor_LAST_NAME().equal(l)).whenNotMatchedThenInsert(TAuthor_ID(),TAuthor_FIRST_NAME(),TAuthor_LAST_NAME(),TAuthor_DATE_OF_BIRTH()).values("String_Node_Str",f,l,0L);
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
q.execute();
assertEquals(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),create().selectFrom(TAuthor()).orderBy(TAuthor_ID()).fetch(TAuthor_FIRST_NAME()));
}