Immutable solution version
Undefined table 'checkpoints' when using Postgres checkpointer
Complete solution
Shows how to fix undefined table 'checkpoints' when using Postgres checkpointer. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
The first time you use PostgresSaver against a database, call checkpointer.setup() before anything else: with PostgresSaver.fromconnstring(DB_URI) as checkpointer: checkpointer.setup(). You only need it once per database, so gate it behind a first-run flag.
Steps
- [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.
When to use
You are seeing this: LangGraph - Undefined table 'checkpoints' when using Postgres. Use this skill when you run into "Undefined table 'checkpoints' when using Postgres checkpointer".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://github.com/langchain-ai/langgraph/issues/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 2 · 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 'checkpoints' when using Postgres checkpointer <span>— Vectle</span></a>