MCPcopy Create free account
hub / github.com/PostHog/duckgres / conversionErrorCode

Function conversionErrorCode

server/conn_errors.go:212–221  ·  view source on GitHub ↗

conversionErrorCode narrows a "Conversion Error: …" message. DuckDB uses this prefix for both invalid text representations and numeric overflows during casts (e.g. CAST(1000 AS TINYINT));

(msg string)

Source from the content-addressed store, hash-verified

210// this prefix for both invalid text representations and numeric overflows
211// during casts (e.g. CAST(1000 AS TINYINT));
212func conversionErrorCode(msg string) string {
213 lower := strings.ToLower(msg)
214 switch {
215 case strings.Contains(lower, "out of range"),
216 strings.Contains(lower, "overflow"),
217 strings.Contains(lower, "would be out of range"):
218 return "22003" // numeric_value_out_of_range
219 }
220 return "22P02" // invalid_text_representation
221}
222
223// constraintErrorCode narrows a "Constraint Error: …" message to one of the
224// integrity_constraint_violation family codes. DuckDB's messages name the

Callers 1

classifyErrorCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected