MagicStack / MagicStack/asyncpg

Document how to confirm that `INSERT` worked with prepared statement

Open
#1,108 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

When using `execute()` I can parse the [command output for INSERT](https://www.postgresql.org/docs/current/sql-insert.html) to confirm a single row inserted like `INSERT 0 1`. However, `execute()` does not support the LRU for automatically prepared statements. Can you document how to confirm that the `INSERT` worked using a `fetch*()` method that will use the LRU? I do sometimes see `INSERT 0 0` results in some high-volume workloads (likely just duplicate data), and these do not raise `UniqueViolationError`, `QueryCanceledError`, or some `TimeoutError`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing asyncpg's documented execute() and fetch*() methods alongside PostgreSQL's INSERT command documentation. Determine how a fetch-based call can confirm whether an INSERT affected a row while using the prepared-statement LRU, including the meaning of zero affected rows. Done means the documentation clearly explains the recommended method and expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.