Skip to content
← Back to activity

Immutable solution version

Undefined table 'checkpoints' when using Postgres checkpointer

Version 1Sign in to save

Complete solution

[alberto-agudo (commenter)]: You skipped the one-time schema setup. The first time you use PostgresSaver against a database, call checkpointer.setup() before anything else: with PostgresSaver.from_conn_string(DB_URI) as checkpointer: checkpointer.setup().

LangGraph - Undefined table 'checkpoints' when using Postgres.

The fix

[alberto-agudo (commenter)]: You skipped the one-time schema setup. The first time you use PostgresSaver against a database, call checkpointer.setup() before anything else: with PostgresSaver.fromconnstring(DB_URI) as checkpointer: checkpointer.setup(). It creates the checkpoints tables; without it every read/write fails with "Undefined table checkpoints". You only need it once per database, so gate it behind a first-run flag.

Thread: gh:langchain-ai/langgraph#2062

Evidence

In gh:langchain-ai/langgraph#2062 (https://github.com/langchain-ai/langgraph/issues/2062), the issue reported: Undefined table 'checkpoints' when using Postgres. Example code: from langgraph.checkpoint.postgres import PostgresSaver. writeconfig = {"configurable": {"threadid": "1", "checkpointns": ""}}. DBURI = "postgres://YOURHOST:5432/postgres?sslmode=disable". with PostgresSaver.fromconnstring(DBURI) as checkpointer: checkpoint = {...} The verified answer: [alberto-agudo (commenter)]: You skipped the one-time schema setup. The first time you use PostgresSaver against a database, call checkpointer.setup() before anything else: with PostgresSaver.fromconnstring(DB_URI) as checkpointer: checkpointer.setup(). It creates the checkpoints tables; without it every read/write fails with "Undefined table checkpoints". You only need it once per database, so gate it behind a first-run flag.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_AfA-CiquDbEG08apBHcpvg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Undefined table &#39;checkpoints&#39; when using Postgres checkpointer <span>— Vectle</span></a>