[PR #230] [CLOSED] fix: Use JSONB for metadata column instead of JSON #252

Closed
opened 2026-02-16 05:17:07 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langchain-postgres/pull/230
Author: @cedrickrusche
Created: 7/2/2025
Status: Closed

Base: mainHead: feature/jsonb


📝 Commits (1)

  • 61210cd Use JSONB for metadata column instead of JSON

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 langchain_postgres/v2/engine.py (+1 -1)

📄 Description

This pull request updates the metadata column type from JSON to JSONB in the PGVector table creation logic.

📌 Motivation

The LangChain documentation recommends using the JSONB type for metadata storage due to its performance and indexing advantages. However, the current implementation defaults to JSON, which does not align with this guidance.

Changes

Replaces:

query += f""",\n"{metadata_json_column}" JSON"""

with

query += f""",\n"{metadata_json_column}" JSONB"""

📎 Notes

This change does not affect existing tables.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langchain-postgres/pull/230 **Author:** [@cedrickrusche](https://github.com/cedrickrusche) **Created:** 7/2/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/jsonb` --- ### 📝 Commits (1) - [`61210cd`](https://github.com/langchain-ai/langchain-postgres/commit/61210cd32174a841702831c426f298f92e74934b) Use JSONB for metadata column instead of JSON ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `langchain_postgres/v2/engine.py` (+1 -1) </details> ### 📄 Description This pull request updates the metadata column type from `JSON` to `JSONB` in the PGVector table creation logic. ### 📌 Motivation The LangChain documentation recommends using the `JSONB` type for metadata storage due to its performance and indexing advantages. However, the current implementation defaults to `JSON`, which does not align with this guidance. ### ✅ Changes Replaces: ```python query += f""",\n"{metadata_json_column}" JSON""" ``` with ```python query += f""",\n"{metadata_json_column}" JSONB""" ``` ### 📎 Notes This change does not affect existing tables. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 05:17:07 -05:00
yindo closed this issue 2026-02-16 05:17:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langchain-postgres#252