You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
12 test cases ran. 1 additional finding, 11 passed.
Across 12 regression and protocol tests, 11 passed and 1 failed, with parser resilience, prepared-statement bind planning, startup/bootstrap behavior, permission enforcement, handshake readiness, normal COPY synchronization, and duplicate CopyDone recovery all behaving as expected.
The most important finding is a High-severity confirmed bug in server/connection_handler.go where an out-of-order Query is accepted and executed during active COPY FROM STDIN instead of being rejected until CopyDone or CopyFail, creating protocol-state desynchronization risk and potentially breaking core data-ingest workflows with no reliable client-side workaround.
✅ Passed (11)
Category
Summary
Screenshot
Bootstrap
Fresh first-run bootstrap created and exposed the postgres default database successfully.
Bootstrap
Injected CREATE DATABASE bootstrap failure recovered cleanly after restart, with postgres connectable.
Parser
Malformed SQL returned a controlled syntax error, and the same session immediately succeeded on SELECT 1 and DEALLOCATE ALL.
Parser
CREATE TABLE, INSERT, and SELECT completed successfully with expected command tags and returned rows.
Permissions
Unprivileged SELECT is correctly denied with a permission error.
Prepared
Controlled ambiguous bind coercion error was returned and the connection stayed healthy for follow-up queries.
Prepared
Parse with empty ParameterOIDs inferred types correctly and inserted/query-backed data matched expectations.
Prepared
Re-parsing the same prepared statement name produced deterministic type replacement without mixed metadata behavior.
Wire
Startup authentication completed and SELECT 1 executed immediately after connect.
Wire
COPY FROM STDIN imported rows and normal query execution resumed afterward.
Wire
Duplicate CopyDone was rejected and the session recovered for subsequent queries.
ℹ️ Additional Findings (1)
These findings are unrelated to the current changes but were observed during testing.
Category
Summary
Screenshot
Wire
⚠️ Out-of-order Query messages are accepted and executed while COPY FROM STDIN is still active.
N/A
⚠️ Out-of-order query accepted during COPY
What failed: The server executes the out-of-order query during COPY mode instead of rejecting it until COPY mode is terminated, breaking copy-mode message boundary enforcement.
Impact: Clients can interleave non-COPY commands into an active COPY stream, which can desynchronize protocol state and break core data-ingest workflows. There is no reliable client-side workaround once the server accepts invalid message ordering.
Steps to reproduce:
Start COPY FROM STDIN so the connection enters copy mode.
Before sending CopyDone or CopyFail, send a Query message on the same connection.
Continue the COPY sequence and observe that the out-of-order query is executed instead of rejected.
Stub / mock context: The run used local socket-level protocol clients against a non-production Doltgres instance and did not rely on mocked server responses for this defect confirmation. A temporary edit in server/analyzer/domain_constraints.go was present during execution, but the reproduced failure is in server/connection_handler.go COPY state dispatch logic.
Code analysis: I reviewed COPY state handling in server/connection_handler.go and found that copyFromStdinState is set for COPY mode, and COPY-specific handlers enforce state checks, but the top-level message dispatcher still routes Query unconditionally without guarding for active COPY mode.
Why this is likely a bug: The code explicitly tracks COPY mode and rejects invalid COPY-state messages, so accepting Query while copyFromStdinState is active is an inconsistent state-machine branch in production message dispatch logic.
// copyFromStdinState is set when this connection is in the COPY FROM STDIN mode, meaning it is waiting on// COPY DATA messages from the client to import data into tables.copyFromStdinState*copyFromStdinState
server/connection_handler.go (lines 769-770)
ifcopyState==nil {
returnfalse, true, errors.Errorf("COPY DATA message received without a COPY FROM STDIN operation in progress")
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
☕ An Automated Dependency Version Bump PR 👑
Initial Changes
The changes contained in this PR were produced by `go get`ing the dependency.
```bash
go get github.com/dolthub/[dependency]/go@[commit]
```