quarkus-langchain4j icon indicating copy to clipboard operation
quarkus-langchain4j copied to clipboard

Pgvector extension broken with Quarkus 3.13.2

Open fmatar opened this issue 1 year ago • 5 comments

The PGVector extension is broken with Quarkus 3.13.2

Reference code: https://github.com/fmatar/rag-playground

Looking at the PgVectorAgroalPoolInterceptor

public class PgVectorAgroalPoolInterceptor implements AgroalPoolInterceptor {

    @Override
    public void onConnectionCreate(Connection connection) {
        try (Statement statement = connection.createStatement()) {
            if (ProfileManager.getLaunchMode().isDevOrTest()) {
                statement.executeUpdate("CREATE EXTENSION IF NOT EXISTS vector");
            }
            PGvector.addVectorType(connection);
        } catch (SQLException exception) {
            if (exception.getMessage().contains("could not open extension control file")) {
                throw new RuntimeException(
                        "The PostgreSQL server does not seem to support pgvector."
                                + "If using containers we suggest to use pgvector/pgvector:pg16 image");
            } else {
                throw new RuntimeException(exception);
            }
        }
    }
}

The ProfileManager class is no longer part of the package.

fmatar avatar Aug 10 '24 09:08 fmatar