public ServerInfo serverInfo() throws SQLException {
        ServerInfo serverInfo = new ServerInfo();
        query(
                "SELECT version(), current_user, current_database()",
                rs -> {
                    if (rs.next()) {
                        serverInfo
                                .withServer(rs.getString(1))
                                .withUsername(rs.getString(2))
                                .withDatabase(rs.getString(3));
                    }
                });
        String username = serverInfo.username();
        if (username != null) {
            query(
                    "SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication FROM pg_roles "
                            + "WHERE pg_has_role('"
                            + username
                            + "', oid, 'member')",
                    rs -> {
                        while (rs.next()) {
                            String roleInfo =
                                    "superuser: "
                                            + rs.getBoolean(3)
                                            + ", replication: "
                                            + rs.getBoolean(8)
                                            + ", inherit: "
                                            + rs.getBoolean(4)
                                            + ", create role: "
                                            + rs.getBoolean(5)
                                            + ", create db: "
                                            + rs.getBoolean(6)
                                            + ", can log in: "
                                            + rs.getBoolean(7);
                            String roleName = rs.getString(2);
                            serverInfo.addRole(roleName, roleInfo);
                        }
                    });
        }
        return serverInfo;
    }
Returns information about the PG server to which this instance is connected.

@return a {@link ServerInfo} instance, never {@code null}
@throws SQLException if anything fails
inlong-sort/sort-flink/sort-flink-v1.13/sort-connectors/postgres-cdc/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java