diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py index 9adf8c4bf..01816c8f2 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py @@ -97,7 +97,7 @@ class PostgresSaver(BasePostgresSaver): strict=False, ): cur.execute(migration) - cur.execute(f"INSERT INTO checkpoint_migrations (v) VALUES ({v})") + cur.execute("INSERT INTO checkpoint_migrations (v) VALUES (%s)", (v,)) if self.pipe: self.pipe.sync() diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py index 66013ea24..1d507b893 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py @@ -102,7 +102,9 @@ class AsyncPostgresSaver(BasePostgresSaver): strict=False, ): await cur.execute(migration) - await cur.execute(f"INSERT INTO checkpoint_migrations (v) VALUES ({v})") + await cur.execute( + "INSERT INTO checkpoint_migrations (v) VALUES (%s)", (v,) + ) if self.pipe: await self.pipe.sync() diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py index 024df3848..d3d5c8f0b 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py @@ -252,7 +252,7 @@ class ShallowPostgresSaver(BasePostgresSaver): strict=False, ): cur.execute(migration) - cur.execute(f"INSERT INTO checkpoint_migrations (v) VALUES ({v})") + cur.execute("INSERT INTO checkpoint_migrations (v) VALUES (%s)", (v,)) if self.pipe: self.pipe.sync() @@ -614,7 +614,9 @@ class AsyncShallowPostgresSaver(BasePostgresSaver): strict=False, ): await cur.execute(migration) - await cur.execute(f"INSERT INTO checkpoint_migrations (v) VALUES ({v})") + await cur.execute( + "INSERT INTO checkpoint_migrations (v) VALUES (%s)", (v,) + ) if self.pipe: await self.pipe.sync()