{"record":{"id":"9d178b2519508aed","repo":"SeaQL/sea-orm","slug":"failed-to-get-time-array-9d178b","errorCode":null,"errorMessage":"Failed to get time array","messagePattern":"Failed to get time array","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_postgres.rs","lineNumber":813,"sourceCode":"                                }),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"TIME\" => Value::ChronoTime(\n                            row.try_get::<Option<chrono::NaiveTime>, _>(c.ordinal())\n                                .expect(\"Failed to get time\"),\n                        ),\n                        #[cfg(all(feature = \"with-time\", not(feature = \"with-chrono\")))]\n                        \"TIME\" => Value::TimeTime(\n                            row.try_get::<Option<time::Time>, _>(c.ordinal())\n                                .expect(\"Failed to get time\"),\n                        ),\n\n                        #[cfg(all(feature = \"with-chrono\", feature = \"postgres-array\"))]\n                        \"TIME[]\" => Value::Array(\n                            sea_query::ArrayType::ChronoTime,\n                            row.try_get::<Option<Vec<chrono::NaiveTime>>, _>(c.ordinal())\n                                .expect(\"Failed to get time array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::ChronoTime(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n                        #[cfg(all(\n                            feature = \"with-time\",\n                            not(feature = \"with-chrono\"),\n                            feature = \"postgres-array\"\n                        ))]\n                        \"TIME[]\" => Value::Array(\n                            sea_query::ArrayType::TimeTime,\n                            row.try_get::<Option<Vec<time::Time>>, _>(c.ordinal())\n                                .expect(\"Failed to get time array\")\n                                .map(|vals| {","sourceCodeStart":795,"sourceCodeEnd":831,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_postgres.rs#L795-L831","documentation":"Panic from `.expect()` in SeaORM's Postgres ProxyRow conversion for `TIME[]` columns in the chrono branch. The driver decodes the column as `Option<Vec<chrono::NaiveTime>>`; when sqlx's decode fails (element type isn't `time`, or chrono array impl not compiled), the panic message is \"Failed to get time array\".","triggerScenarios":"Selecting a `TIME[]` column through ProxyRow with `with-chrono` + `postgres-array` enabled and the value won't decode to `Vec<NaiveTime>` — e.g. the column is `timetz[]`, `timestamp[]`, or another array type misreported as `TIME[]`.","commonSituations":"Arrays of `TIME WITH TIME ZONE` elements; schema drift from time[] to interval[]; views with inferred array element types; missing `postgres-array` feature causing branch mis-selection; sea-orm/sqlx version skew.","solutions":["Verify the column is exactly `time[]` and cast if needed (`col::time[]`).","Enable `with-chrono` and `postgres-array` features together on sea-orm.","Keep sea-orm and sqlx versions aligned for chrono array decoding.","Select the array as text and parse elements when the source type is uncontrolled."],"exampleFix":"// before: column is timetz[]\nlet rows = q.map(|row| row.into_proxy_row()).await?; // panics\n\n// after\nlet stmt = Statement::from_string(\n    db.get_database_backend(),\n    \"SELECT slots::time[] AS slots FROM calendars\",\n);","handlingStrategy":"try-catch","validationCode":"let elem: Option<String> = sqlx::query_scalar(\n    \"SELECT e.data_type FROM information_schema.columns c, LATERAL (SELECT data_type FROM information_schema.element_types WHERE object_name=c.table_name AND collection_type_identifier=c.dtd_identifier) e WHERE c.table_name=$1 AND c.column_name=$2\")\n    .bind(\"calendars\").bind(\"slots\").fetch_optional(db).await?;\nassert_eq!(elem.as_deref(), Some(\"time without time zone\"));","typeGuard":"fn is_time_array(elem: &str) -> bool { elem.eq_ignore_ascii_case(\"time without time zone\") }","tryCatchPattern":"let result = std::panic::catch_unwind(AssertUnwindSafe(|| stmt_to_proxy_rows(&stmt)));\nmatch result {\n    Ok(rows) => rows,\n    Err(_) => decode_time_array_as_text(\"slots\"),\n}","preventionTips":["Cast arrays to time[] in queries; never let timetz[] reach ProxyRow.","Enable with-chrono + postgres-array features together.","Inspect information_schema.element_types for true array element OIDs.","Keep sea-orm/sqlx versions aligned; test array decoding in CI."],"tags":["postgres","sqlx","type-mismatch","array-decode","time"],"backgroundTag":"type-mismatch","analyzedSha":"e29bcd1b417c41a553b386fe94511d7c64a1c8ec","analyzedAt":"2026-09-10T11:31:52.468Z","contentChangedAt":"2026-09-10T11:31:52.468Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}