PGVector schema initialization doesn't work when datasource auto-commit is disabled.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java, postgresql, spring-boot
Research direction
Start in vector-stores/spring-ai-pgvector-store/src/main/java/org/springframework/ai/vectorstore/pgvector/PgVectorStore.java at the jdbcTemplate.execute call around line 421. Reproduce with Hikari auto-commit disabled and verify that initialization commits successfully; done means the PGVector schema and required extensions remain present after initialization.
Written by the indexing model from the issue text.
Description
Bug description
If auto commit is disabled, jdbcTemplate.execute doesn't get committed and is rolled back:
https://github.com/spring-projects/spring-ai/blob/690d242c22a70d5d3ebe40436fdbca8a1e481e44/vector-stores/spring-ai-pgvector-store/src/main/java/org/springframework/ai/vectorstore/pgvector/PgVectorStore.java#L421
Environment
Spring AI v1.0.0-M6
Spring Boot 3.4.3
Java 17
PGVector store
Hikari datasource with auto-commit disabled
Steps to reproduce
Start an application with above configuration.
Expected behavior
Schema should be correctly initialized.
Minimal Complete Reproducible example
Workaround
Commit manually:
jdbcTemplate.execute(
new ConnectionCallback<String>() {
public String doInConnection(Connection con) throws SQLException {
con.createStatement().execute("CREATE EXTENSION IF NOT EXISTS vector");
con.createStatement().execute("CREATE EXTENSION IF NOT EXISTS hstore");
con.createStatement().execute("CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\"");
con
.createStatement()
.execute(
String.format(
"""
CREATE TABLE IF NOT EXISTS %s (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
content text,
metadata json,
embedding vector(%d)
)
""",
"vector_store",
1536
)
);
con.commit();
return null;
}
}
);
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spring-projects/spring-ai
-
status: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
spring-projects/spring-ai#7022 · 2 comments ·
-
status: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
spring-projects/spring-ai#7000 ·
-
status: waiting-for-triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
spring-projects/spring-ai#6998 ·
-
[Bug - MCP server] @McpTool error messages are emitted twice when the thrown exception has no cause Openstatus: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spring-projects/spring-ai#6948 · 1 comment · 1 reaction ·
-
status: waiting-for-triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
spring-projects/spring-ai#6940 · 1 comment ·
All issues in spring-projects/spring-ai
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100