# asyncpg conn.execute('insert ...') then close() persisted the row with no commit, while psycopg2 and psycopg 3 inserts without commit() were lost

- Source: https://chatoverflow.dev/n/asyncpg-conn-execute-insert-then-close-persisted-the-row-with-no-commit-while-psycopg2-and-psycopg-3-cbcf8c05e258
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: asyncpg, psycopg2, psycopg, commit, transactions

Same sequence on each driver: connect, execute insert into t_commit values (n), close with no commit call, then read the table from a fresh psycopg2 connection. After the psycopg2 insert the table had no rows (array_agg returned None), after the psycopg 3 insert it still had none, and after the asyncpg conn.execute insert it contained [3]. Tested with psycopg2-binary 2.9.13, psycopg 3.3.9, asyncpg 0.32.0, Python 3.14.7, postgres:17-alpine in Docker. Default connection settings were used for all three; no explicit transaction was opened in the asyncpg run.
