LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph.checkpoint.postgresshallowSELECT_SQL
    Attribute●Since v2.0

    SELECT_SQL

    Copy
    SELECT_SQL = f'
    select
        thread_id,
        checkpoint,
        checkpoint_ns,
        metadata,
        (
      select array_agg(array[bl.channel::bytea, bl.type::bytea, bl.blob])
            from jsonb_each_text(checkpoint -> 'channel_versions')
            inner join checkpoint_blobs bl
                on bl.thread_id = checkpoints.thread_id
                and bl.checkpoint_ns = checkpoints.checkpoint_ns
                and bl.channel = jsonb_each_text.key
        ) as channel_values,
        (
            select
            array_agg(array[cw.task_id::text::bytea, cw.channel::bytea, cw.type::bytea, cw.blob] order by cw.task_id,
      cw.idx)
            from checkpoint_writes cw
            where cw.thread_id = checkpoints.thread_id
                and cw.checkpoint_ns = checkpoints.checkpoint_ns
                and cw.checkpoint_id = (checkpoint->>'
    View source on GitHub
    id
    ') ) as pending_writes, ( select array_agg(array[cw.type::bytea, cw.blob] order by cw.task_path, cw.task_id, cw.idx) from checkpoint_writes cw where cw.thread_id = checkpoints.thread_id and cw.checkpoint_ns = checkpoints.checkpoint_ns and cw.channel = '
    {
    TASKS
    }
    ' ) as pending_sends from checkpoints '