transformErrorSQLState returns the SQLSTATE for a transpiler-detected error. A transform may attach an explicit code (e.g. 0A000 for an unsupported feature via transform.CodedError); otherwise it defaults to 42704 (undefined_object), matching the historical behavior for unrecognized config parameter
(err error)
| 123 | // only signal the Go driver exposes today, so we parse the message string. |
| 124 | func classifyErrorCode(err error) string { |
| 125 | // Wire-side SQLSTATE: 57014 is correct for any cancellation regardless of |
| 126 | // whether the caller drove it. Use isQueryCancelled here, not the |
| 127 | // clientConn-aware variant — classifyErrorCode is called from contexts |
| 128 | // that don't have a *clientConn (e.g., direct test fixtures). |
| 129 | if isQueryCancelled(err) { |
| 130 | return "57014" |
| 131 | } |
| 132 | if isDuckLakeTransactionConflict(err) { |
| 133 | return "40001" // serialization_failure — client should retry |
| 134 | } |
no test coverage detected