Skip to content

"readonly" is only supported for serializable transactions #743

Closed

Description

@pauldraper

asyncpg version: 0.22.0

Example

import asyncio
import asyncpg

async def main():
    conn = await asyncpg.connect()
    conn.transaction(isolation='repeatable_read', readonly=True)

asyncio.run(main())

Expected result

No error.

Actual result

 "readonly" is only supported for serializable transactions

That's just not true.

START TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY;

The really bizarre thing is that some had to go out of their way to break this in asyncpg.

And not only that, but the check doesn't really even work that well.

A workaround is to first run SET default_transaction_isolation = 'repeatable read'; for the connection, and then avoid passing an isolation argument to the transaction() function.

Activity

  1. added a commit that references this issue on Apr 24, 2021
    679e32d
  2. added a commit that references this issue on Apr 26, 2021
    5cf4089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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