Skip to content

cannot execute SELECT FOR UPDATE in a read-only transaction (25006) #878

@matteosilv

Description

@matteosilv

PgDog version
v0.1.34

Description
we have this query:

-- name: CountRetryableTransactions :one
WITH retries_available AS (SELECT 1
                           FROM retries
                           WHERE next_retry_at <= NOW()
                             AND deleted_at IS NULL
    FOR UPDATE SKIP LOCKED
)
SELECT COUNT(*)
FROM retries_available

The query should have been routed to the write replica. If the query needs to be wrapped in an explicit transaction, the documentation at https://docs.pgdog.dev/features/load-balancer/#select-for-update could be a little more explicit about it.

Logs

pq: cannot execute SELECT FOR UPDATE in a read-only transaction (25006)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions