Skip to content

[FIXED in 4.5.0] A query that fails after returning rows leaves empty slots at the start of the next query's result #68

Closed

Description

@okomarov

DataRow writes result[rows++], and ReadyForQuery resets result but not rows (src/connection.js). rows is only reset in CommandComplete, PortalSuspended and on close. After an ErrorResponse in the middle of a result, the next query on that connection starts at the old index, so its result array begins with empty slots.

The most-reported data bug upstream: porsager#1181, porsager#1119, porsager#795, porsager#1253 (the cleanest reproduction). Proposed fixes: porsager#1254 (one line, with a test that doesn't depend on timing), porsager#1190, porsager#1120.

Fix: reset rows in ReadyForQuery. Test: a query that errors after sending rows, then another query on the same connection.

Activity

  1. added
    bugSomething isn't working
    area: protocolProtocol messages and result handling
    upstreamAnswers porsager/postgres reports
    on Oct 16, 2026
  2. moved this to Next in Roadmapon Oct 16, 2026
  3. added this to the 4.5.0 milestone on Oct 16, 2026
  4. moved this from Next to In progress in Roadmapon Oct 16, 2026
  5. added a commit that references this issue on Oct 17, 2026
  6. okomarov commented on Oct 17, 2026

    @okomarov
    Author

    Shipped in 4.5.0.

  7. moved this from In progress to Shipped in Roadmapon Oct 17, 2026
  8. changed the title [-]A query that fails after returning rows leaves empty slots at the start of the next query's result[/-] [+][FIXED in 4.5.0] A query that fails after returning rows leaves empty slots at the start of the next query's result[/+] on Oct 17, 2026
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

    area: protocolProtocol messages and result handlingbugSomething isn't workingupstreamAnswers porsager/postgres reports

    Type

    No type

    Projects

    • Status
      Shipped

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions