Skip to content

Conversation

@tongda
Copy link
Contributor

@tongda tongda commented Jan 21, 2026

Description

When storing text_chunks, it is necessary to support the scenario where users' custom chunkers output custom fields. Among the several implementations of KVStorage, only postgres does not support custom fields, while json/mongo/redis natively support custom fields. This commit aims to enable postgres to support custom fields.

Changes Made

  • Introduced a new column custom_data to the LIGHTRAG_DOC_CHUNKS table.
  • Added migration method to check for the existence of the column and create it if missing.
  • Implemented logic to merge custom data into chunk data during retrieval.
  • Updated SQL templates to include the new custom_data field in relevant queries.

Checklist

  • Changes tested locally
  • Code reviewed
  • Documentation updated (if necessary)
  • Unit tests added (if applicable)

Tong Da added 2 commits January 21, 2026 21:03
…lement migration logic

- Introduced a new column `custom_data` to the LIGHTRAG_DOC_CHUNKS table.
- Added migration method to check for the existence of the column and create it if missing.
- Implemented logic to merge custom data into chunk data during retrieval.
- Updated SQL templates to include the new custom_data field in relevant queries.
…KVStorage class

- Removed unnecessary whitespace in the PGKVStorage class methods.
- Reformatted the standard_fields declaration for better readability.
- No functional changes were made to the code.
@tongda tongda changed the title feat(postgres): Add custom_data column to LIGHTRAG_DOC_CHUNKS and implement migration logic Enable the postgres implementation of text_chunks to support custom fields Jan 21, 2026
@danielaskdd
Copy link
Collaborator

@claude review

@claude
Copy link

claude bot commented Jan 22, 2026

Claude encountered an error —— View job

Command failed: git fetch origin --depth=20 posgres_add_custom_data_to_text_chunks

I'll analyze this and get back to you.

@danielaskdd
Copy link
Collaborator

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tongda
Copy link
Contributor Author

tongda commented Feb 9, 2026

@danielaskdd hi, danial, would you like to merge this pr to main branch?

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.

2 participants