Skip to content

fix memory leak and Inserttable batch - #92

Merged
Cito merged 2 commits into
PyGreSQL:mainfrom
justinpryzby:inserttable-batch
Jan 25, 2026
Merged

fix memory leak and Inserttable batch#92
Cito merged 2 commits into
PyGreSQL:mainfrom
justinpryzby:inserttable-batch

Conversation

@justinpryzby

Copy link
Copy Markdown
Collaborator

No description provided.

Justin Pryzby added 2 commits January 4, 2026 18:22
This won't be an issue in real life, but this keeps the test suite clean.

Found with: PYTHONPATH=pg valgrind --leak-check=full pytest ./tests/test_classic_connection.py::TestInserttable::test_inserttable_with_invalid_table_name  ./tests/test_classic_connection.py::TestInserttable::test_inserttable_with_invalid_column_name
This is especially important for nonlocal DBs, where libpq would do a
round trip for each row.

For a local DB, this is already ~10% faster.

$ time PYTHNOPATH=pg python3.11 -c "import pg; db=pg.DB(host='/tmp'); db.inserttable('t', [[1]]*9999999)"
real    0m2,079s
@justinpryzby
justinpryzby marked this pull request as ready for review January 24, 2026 02:18
@Cito
Cito merged commit 15ab3ba into PyGreSQL:main Jan 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants