isAlterTableNotTableError checks if the error indicates that an ALTER TABLE was attempted on a view. DuckDB returns this error when trying to use ALTER TABLE ... RENAME TO on a view instead of ALTER VIEW.
(err error)
| 308 | "0A": {}, // feature_not_supported — user used a SQL feature we don't have |
| 309 | "22": {}, // data_exception — bad input (cast, overflow, encoding) |
| 310 | "23": {}, // integrity_constraint_violation — unique/fk/check/not_null |
| 311 | "25": {}, // invalid_transaction_state — nested BEGIN, etc. |
| 312 | "28": {}, // invalid_authorization_specification — not hit on this path today |
| 313 | "2B": {}, // dependent_objects_still_exist — DROP without CASCADE |
| 314 | "3D": {}, // invalid_catalog_name — DB doesn't exist |
| 315 | "3F": {}, // invalid_schema_name — schema doesn't exist |
| 316 | "42": {}, // syntax_error_or_access_rule_violation — table/column not found, syntax |
| 317 | "44": {}, // with_check_option_violation |
| 318 | } |
| 319 | |
| 320 | func isUserQueryErrorCode(code string) bool { |
| 321 | if len(code) < 2 { |
| 322 | return false |
| 323 | } |
| 324 | _, ok := userErrorSQLSTATEClasses[code[:2]] |
| 325 | return ok |
| 326 | } |
| 327 | |
| 328 | // isUserQueryError tells the log/observability path whether a query |
| 329 | // failure is user-attributable (Info-level "Query execution failed.") |