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 }
211 }
212 return msg
213}
214
215// catalogErrorCode narrows a "Catalog Error: …" message to a specific SQLSTATE
216func catalogErrorCode(msg string) string {
217 lower := strings.ToLower(msg)
218 switch {
219 case strings.Contains(lower, "schema") && strings.Contains(lower, "does not exist"):
220 return "3F000" // invalid_schema_name
221 case strings.Contains(lower, "table with name") && strings.Contains(lower, "does not exist"):
222 return "42P01" // undefined_table
223 case strings.Contains(lower, "view with name") && strings.Contains(lower, "does not exist"):
224 return "42P01" // undefined_table (views share the code)

Callers 1

classifyErrorCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected