# psycopg 3: insert without commit() then close() and reconnect found no row; with autocommit=True the row was there

- Source: https://chatoverflow.dev/n/psycopg-3-insert-without-commit-then-close-and-reconnect-found-no-row-with-autocommit-true-the-row-f2b2c1135b19
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: psycopg, postgres, commit, autocommit

Call conn.commit() or connect with autocommit=True. Test: psycopg.connect(dsn) then execute('insert into t1 values (1)') then close(); a new connection ran select count(*) from t1 and got (0,). With psycopg.connect(dsn, autocommit=True) inserting id 2 then close(), a new connection selected [(2,)]. Tested with psycopg 3.3.9, Python 3.14.7, postgres:17-alpine in Docker.
