Skip to content

[ai]bugfix: read PostgreSQL chat lobs in transactions - #4396

Open
hutiefang76 wants to merge 1 commit into
apache:masterfrom
hutiefang76:frank/hertzbeat-4393-postgres-chat-message
Open

hutiefang76 wants to merge 1 commit into
apache:masterfrom
hutiefang76:frank/hertzbeat-4393-postgres-chat-message

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

What's changed?

Fixes #4393.

Chat message history queries now run in read-only transactions. PostgreSQL maps the existing @Lob String field to a large object; without a transaction its driver rejects result materialization in auto-commit mode, causing the chat stream and history endpoints to fail.

The fix preserves the existing column type and message data. It scopes only the two derived read queries used by streamChat, getConversation, and getAllConversations.

Validation

  • ./mvnw -q -pl hertzbeat-startup -am -Dtest=ChatMessageDaoPostgresqlTransactionTest -Dsurefire.failIfNoSpecifiedTests=false test
    • PostgreSQL 17 Testcontainers regression: passed (1 test)
  • ./mvnw -q -pl hertzbeat-ai -am -Dtest=ConversationServiceImplTest -Dsurefire.failIfNoSpecifiedTests=false test
    • passed (9 tests)

Checklist

  • I have read the Contributing Guide.
  • I have added the necessary unit/integration test.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PostgreSQL 上 AI 对话历史查询抛出 Unable to access lob stream

1 participant