Skip to content

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

Open
jadengis wants to merge 1 commit intolangchain-ai:mainfrom
jadengis:store-pool-share
Open

feat(store): enhance PostgresStore to support shared pg.Pool instances#1966
jadengis wants to merge 1 commit intolangchain-ai:mainfrom
jadengis:store-pool-share

Conversation

@jadengis
Copy link

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.

@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2026

🦋 Changeset detected

Latest commit: d104269

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@langchain/langgraph-checkpoint-postgres Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

- 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.
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.

1 participant