import com.mysql.cj.jdbc.util.BaseBugReport; import java.util.Properties; public class ParsingUpsertWithSetClauseThrowsException extends BaseBugReport { @Override public void setUp() throws Exception { try (var statement = getConnection().createStatement()) { statement.execute("create table `test` (`id` int)"); } } @Override public void tearDown() throws Exception { try (var statement = getConnection().createStatement()) { statement.execute("drop table `test`"); } } @Override public void runTest() throws Exception { var props = new Properties(); props.setProperty("rewriteBatchedStatements", "true"); try (var connection = getConnection(getUrl(), props)) { //language=MySQL var sql = "insert into `test` " + "set `id` = 1 " + "on duplicate key update `id` = values(`id`) + 1"; try (var statement = connection.prepareStatement(sql)) { statement.execute(); } } } public static void main(String[] args) throws Exception { new ParsingUpsertWithSetClauseThrowsException().run(); } }