class ResultSetRelation implements Relation {

	@Override
	public long getSize() throws InputException {
		try (ResultSet resultSet = executeQuery("SELECT COUNT(*) FROM (" + query + ") rel")) {
			if (resultSet.next()) {
				return resultSet.getLong(1);
			}
			throw new IllegalStateException("No count returned");
		} catch (SQLException e) {
			throw new InputOpenException(e);
		}
	}

}