[PR #1966] feat(store): enhance PostgresStore to support shared pg.Pool instances #1878

Open
opened 2026-02-15 20:17:10 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1966
Author: @jadengis
Created: 2/15/2026
Status: 🔄 Open

Base: mainHead: store-pool-share


📝 Commits (1)

  • 0a0599c feat(store): enhance PostgresStore to support shared pg.Pool instances

📊 Changes

3 files changed (+164 additions, -9 deletions)

View changed files

📝 libs/checkpoint-postgres/src/store/index.ts (+60 -7)
📝 libs/checkpoint-postgres/src/store/modules/types.ts (+14 -2)
📝 libs/checkpoint-postgres/src/tests/store.int.test.ts (+90 -0)

📄 Description

Summary

PostgresSaver supports passing in a preconfigured pool instance. PostgresStore should support this as well, otherwise you will need to have two Pools running per server in order to use these features in tandem. This puts a lot of connection pressure on the database.

Changes

  • Updated PostgresStoreConfig to accept a preconfigured pg.Pool.
  • Added fromPool static method for creating PostgresStore instances from an existing pool.
  • Modified connection handling to allow sharing a pool between PostgresStore and PostgresSaver.
  • Updated stop method to conditionally close the pool based on ownership.
  • Added integration tests for pool sharing functionality.

🔄 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/langgraphjs/pull/1966 **Author:** [@jadengis](https://github.com/jadengis) **Created:** 2/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `store-pool-share` --- ### 📝 Commits (1) - [`0a0599c`](https://github.com/langchain-ai/langgraphjs/commit/0a0599c70d669833110c02ec9ad1fcdd571c0e5f) feat(store): enhance PostgresStore to support shared pg.Pool instances ### 📊 Changes **3 files changed** (+164 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `libs/checkpoint-postgres/src/store/index.ts` (+60 -7) 📝 `libs/checkpoint-postgres/src/store/modules/types.ts` (+14 -2) 📝 `libs/checkpoint-postgres/src/tests/store.int.test.ts` (+90 -0) </details> ### 📄 Description ## Summary PostgresSaver supports passing in a preconfigured pool instance. PostgresStore should support this as well, otherwise you will need to have two Pools running per server in order to use these features in tandem. This puts a lot of connection pressure on the database. ## Changes - Updated PostgresStoreConfig to accept a preconfigured pg.Pool. - Added fromPool static method for creating PostgresStore instances from an existing pool. - Modified connection handling to allow sharing a pool between PostgresStore and PostgresSaver. - Updated stop method to conditionally close the pool based on ownership. - Added integration tests for pool sharing functionality. <!-- Thank you for contributing to LangGraph.js! Your PR will appear in our next release under the title you set above. Please make sure it highlights your valuable contribution. To help streamline the review process, please make sure you read our contribution guidelines: https://github.com/langchain-ai/langgraphjs/blob/main/CONTRIBUTING.md Replace this block with a description of the change, the issue it fixes (if applicable), and relevant context. Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle below! --> --- <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-15 20:17:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1878