Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conn.execute return value #1238

Open
BlindChickens opened this issue Feb 28, 2025 · 0 comments
Open

conn.execute return value #1238

BlindChickens opened this issue Feb 28, 2025 · 0 comments

Comments

@BlindChickens
Copy link

BlindChickens commented Feb 28, 2025

asyncpg version: 0.30
PostgreSQL version:
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?:
Python version: 3.11
Platform: Ubuntu
Do you use pgbouncer?: No
Did you install asyncpg with pip?: Yes
If you built asyncpg locally, which version of Cython did you use?:
Can the issue be reproduced under both asyncio and uvloop?: NA

When I do execute on a connection, the return value looks like it brings back the number of rows with SELECT prepended to it.

Example:
If you run:

conn.execute("SELECT now();")

The output is SELECT 1

If you run:

conn.execute("SELECT generate_series(0, 100);")

The output is SELECT 101

Obviously with a fetch it brings back the correct result, but I am specifically interested in the return value of a multi statement execute.

ie, I want to do

conn.execute("SELECT generate_series(0, 100); SELECT now();")

And the return value should be the last return value.

Is this possible? What am I missing?

Thanks in advance

And PS. The ISSUE_TEMPLATE is not applying when creating the issue, I copied it in.

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

No branches or pull requests

1 participant