private static void generatedKeysHandler(PreparedStatement ps, LongConsumer longConsumer) throws SQLException {
        /*
         * There does not seem to be any way to find the generated keys from a Postgres JDBC driver
         * since getGeneratedKeys() returns the whole set of columns. This causes
         * bug #293 "The postgresql throws an exception when the PRIMARY KEY is not type long."
         *
         * See http://stackoverflow.com/questions/19766816/postgresql-jdbc-getgeneratedkeys-returns-all-columns
         *
         * Below we instead handle auto generated fields that can be retrieved as Long. This fix clearly only
         * works for generated fields that are also auto generated.
         */

        try (final ResultSet generatedKeys = ps.getGeneratedKeys()) {
            while (generatedKeys.next()) {
                final int columnType = generatedKeys.getMetaData().getColumnType(1);
                if (generatedKeys.getMetaData().isAutoIncrement(1) && LONG_GETTABLE_TYPES.contains(columnType)) {
                    longConsumer.accept(generatedKeys.getLong(1));
                }
            }
        }
    }
@author  Emil Forslund
@author  Dan Lawesson
@since   3.0.0
runtime-parent/runtime-connector-parent/postgres/src/main/java/com/speedment/runtime/connector/postgres/internal/PostgresDbmsOperationHandler.java