@Override
  void handle(Connection connection, DatabaseCharsetChecker.State state) throws SQLException {
    // PostgreSQL does not have concept of case-sensitive collation. Only charset ("encoding" in postgresql terminology)
    // must be verified.
    expectUtf8AsDefault(connection);

    if (state == DatabaseCharsetChecker.State.UPGRADE || state == DatabaseCharsetChecker.State.STARTUP) {
      // no need to check columns on fresh installs... as they are not supposed to exist!
      expectUtf8Columns(connection);
    }
  }
@Test
  public void schema_is_taken_into_account_when_selecting_columns() throws Exception {
    answerDefaultCharset("utf8");
    answerSchema("test-schema");
    answerColumns(asList(
      new String[] {TABLE_ISSUES, COLUMN_KEE, "utf8"},
      new String[] {TABLE_PROJECTS, COLUMN_NAME, "" /* unset -> uses db collation */}));

    // no error
    assertThatCode(() -> underTest.handle(connection, DatabaseCharsetChecker.State.UPGRADE))
      .doesNotThrowAnyException();

    verify(sqlExecutor).select(same(connection), eq("select table_name, column_name,"
      + " collation_name "
      + "from information_schema.columns "
      + "where table_schema='test-schema' "
      + "and table_name in (" + SqTables.TABLES.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")) + ") "
      + "and udt_name='varchar' order by table_name, column_name"), any(SqlExecutor.StringsConverter.class));
  }