stmt.executeUpdate("INSERT INTO testerr (id, val) VALUES (1, 1)");
try {
stmt.executeUpdate("INSERT INTO testerr (id, val) VALUES (1, 1)");
fail("Should have thrown a duplicate key exception.");
} catch (SQLException sqle) {
ServerErrorMessage err = ((PSQLException)sqle).getServerErrorMessage();
assertEquals("public", err.getSchema());
assertEquals("testerr", err.getTable());
assertEquals("testerr_pk", err.getConstraint());
assertNull(err.getDatatype());
assertNull(err.getColumn());
}
stmt.close();
}