Skip to content

conn.execute return value #1238

Open
Open
@BlindChickens

Description

@BlindChickens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions