diff --git a/src/sqlancer/stonedb/gen/StoneDBTableInsertGenerator.java b/src/sqlancer/stonedb/gen/StoneDBTableInsertGenerator.java index a9823be6d..0a70c8467 100644 --- a/src/sqlancer/stonedb/gen/StoneDBTableInsertGenerator.java +++ b/src/sqlancer/stonedb/gen/StoneDBTableInsertGenerator.java @@ -48,6 +48,7 @@ private SQLQueryAdapter getQuery() { sb.append(table.getName()); appendPartition(); appendColumnsAndValues(columns); + appendAS(); appendOnDuplicateUpdate(); addExpectedErrors(); return new SQLQueryAdapter(sb.toString(), errors); @@ -84,6 +85,14 @@ private void appendColumnsAndValues(List columns) { appendValues(); } + private void appendAS() { + if (!globalState.getDbmsSpecificOptions().test80Version) { + return; + } + sb.append(" AS "); + sb.append("r").append(table.getNrRows(globalState)); + } + private void appendOnDuplicateUpdate() { sb.append("on duplicate key update "); StoneDBColumn randomColumn = table.getRandomColumn();