diff --git a/libs/checkpoint-postgres/langgraph/store/postgres/base.py b/libs/checkpoint-postgres/langgraph/store/postgres/base.py index a4d31b546..825590e23 100644 --- a/libs/checkpoint-postgres/langgraph/store/postgres/base.py +++ b/libs/checkpoint-postgres/langgraph/store/postgres/base.py @@ -91,7 +91,12 @@ WHERE expires_at IS NOT NULL; VECTOR_MIGRATIONS: Sequence[Migration] = [ Migration( """ -CREATE EXTENSION IF NOT EXISTS vector; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector') THEN + CREATE EXTENSION vector; + END IF; +END $$; """, ), Migration(