package sqlancer.mysql; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import sqlancer.common.query.ExpectedErrors; public final class MySQLErrors { private MySQLErrors() { } public static List getExpressionErrors() { ArrayList errors = new ArrayList<>(); errors.add("BIGINT value is out of range"); // e.g., CAST(-('-1e500') AS SIGNED) errors.add("is not valid for CHARACTER SET"); if (MySQLBugs.bug111471) { errors.add("Memory capacity exceeded"); } return errors; } public static List getExpressionRegexErrors() { ArrayList errors = new ArrayList<>(); if (MySQLBugs.bug114533) { errors.add(Pattern.compile("For input string: \"0+-0\"")); // match: For input string: // "00000000000000000000-0" } errors.add(Pattern.compile("Unknown column '.*' in 'order clause'")); errors.add(Pattern.compile("Unknown column '.*' in 'EXISTS subquery'")); return errors; } public static void addExpressionErrors(ExpectedErrors errors) { errors.addAll(getExpressionErrors()); errors.addAllRegexes(getExpressionRegexErrors()); } public static List getInsertUpdateErrors() { ArrayList errors = new ArrayList<>(); errors.add("doesn't have a default value"); errors.add("Data truncation"); errors.add("Incorrect integer value"); errors.add("Duplicate entry"); errors.add("Data truncated for column"); errors.add("Data truncated for functional index"); errors.add("cannot be null"); errors.add("Incorrect decimal value"); errors.add("The value specified for generated column"); return errors; } public static void addInsertUpdateErrors(ExpectedErrors errors) { errors.addAll(getInsertUpdateErrors()); } }