Skip to content

Commit

Permalink
Merge pull request #729 from quarkiverse/#728
Browse files Browse the repository at this point in the history
Don't run CREATE EXTENSION IF NOT EXISTS vector in prod mode
  • Loading branch information
jmartisk authored Jul 8, 2024
2 parents 6cf4c93 + cc802af commit abc0699
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.pgvector.PGvector;

import io.agroal.api.AgroalPoolInterceptor;
import io.quarkus.runtime.configuration.ProfileManager;

/**
* PgVectorAgroalPoolInterceptor intercept connection creation and add needed settings for pgvector
Expand All @@ -16,7 +17,9 @@ public class PgVectorAgroalPoolInterceptor implements AgroalPoolInterceptor {
@Override
public void onConnectionCreate(Connection connection) {
try (Statement statement = connection.createStatement()) {
statement.executeUpdate("CREATE EXTENSION IF NOT EXISTS vector");
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")) {
Expand Down

0 comments on commit abc0699

Please sign in to comment.