{"record":{"id":"33d021443179fa6c","repo":"cube-js/cube","slug":"unsupported-data-type-for-list","errorCode":null,"errorMessage":"Unsupported data type for List: {}","messagePattern":"Unsupported data type for List: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubesql/cubesql/src/sql/types.rs","lineNumber":70,"sourceCode":"            ColumnType::Int8 => PgTypeId::INT2,\n            ColumnType::Int32 => PgTypeId::INT4,\n            ColumnType::String | ColumnType::VarStr => PgTypeId::TEXT,\n            ColumnType::Interval(_) => PgTypeId::INTERVAL,\n            ColumnType::Date(_) => PgTypeId::DATE,\n            ColumnType::Timestamp => PgTypeId::TIMESTAMP,\n            ColumnType::Double => PgTypeId::NUMERIC,\n            ColumnType::Decimal(_, _) => PgTypeId::NUMERIC,\n            ColumnType::List(field) => match field.data_type() {\n                DataType::Binary => PgTypeId::ARRAYBYTEA,\n                DataType::Boolean => PgTypeId::ARRAYBOOL,\n                DataType::Utf8 => PgTypeId::ARRAYTEXT,\n                DataType::Int16 => PgTypeId::ARRAYINT2,\n                DataType::Int32 => PgTypeId::ARRAYINT4,\n                DataType::Int64 => PgTypeId::ARRAYINT8,\n                DataType::UInt16 => PgTypeId::ARRAYINT2,\n                DataType::UInt32 => PgTypeId::ARRAYINT4,\n                DataType::UInt64 => PgTypeId::ARRAYINT8,\n                dt => unimplemented!(\"Unsupported data type for List: {}\", dt),\n            },\n        }\n    }\n\n    pub fn avg_size(&self) -> usize {\n        match self {\n            ColumnType::Boolean | ColumnType::Int8 => 1,\n            ColumnType::Int32\n            | ColumnType::Date(true)\n            | ColumnType::Interval(IntervalUnit::YearMonth) => 4,\n            ColumnType::Double\n            | ColumnType::Int64\n            | ColumnType::Date(false)\n            | ColumnType::Interval(IntervalUnit::DayTime)\n            | ColumnType::Timestamp => 8,\n            ColumnType::Interval(IntervalUnit::MonthDayNano) | ColumnType::Decimal(_, _) => 16,\n            ColumnType::String | ColumnType::VarStr => 64,\n            ColumnType::Blob | ColumnType::List(_) => 128,","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubesql/cubesql/src/sql/types.rs#L52-L88","documentation":"When mapping Cube's internal DataType to a PostgreSQL wire type for list/array columns, only a fixed set of element types is translated. Any other element type falls into a catch-all unimplemented! panic, since no corresponding PgTypeId ARRAY OID exists in the mapping.","triggerScenarios":"add_attribute serializing a result column that is a List whose element DataType is not one of the handled numeric types — e.g. list of strings, booleans, decimals, or dates.","commonSituations":"Queries returning arrays of non-integer elements through the Postgres protocol; data models that expose array fields whose element types weren't anticipated by the type mapping table.","solutions":["Cast the array elements to a supported type (int) in the data model or query before returning","Avoid exposing array columns of unhandled element types over the Postgres protocol","Add the missing mapping (e.g. Utf8 -> a text array PgTypeId) in types.rs:70","Unnest the array into scalar rows in the query"],"exampleFix":"// before\ndt => unimplemented!(\"Unsupported data type for List: {}\", dt),\n// after\nDataType::Utf8 => PgTypeId::ARRAYTEXT,\ndt => PgTypeId::ARRAYTEXT, // fallback with a warning log","handlingStrategy":"validation","validationCode":"fn list_element_supported(dt: &DataType) -> bool {\n    matches!(dt, DataType::List(f) if matches!(f.data_type(), DataType::Int16|DataType::Int32|DataType::Int64|DataType::UInt16|DataType::UInt32|DataType::UInt64))\n}","typeGuard":"fn to_pg_array_type(dt: &DataType) -> Option<PgTypeId> {\n    match dt { DataType::Int64 => Some(PgTypeId::ARRAYINT8), DataType::Utf8 => Some(PgTypeId::ARRAYTEXT), _ => None }\n}","tryCatchPattern":"match to_pg_type(dt) {\n    Some(t) => t,\n    None => { log::warn!(\"falling back to text for {}\", dt); PgTypeId::ARRAYTEXT }\n}","preventionTips":["Expose only supported array element types through the Postgres protocol","Cast arrays to supported element types in the data model","Maintain a table-driven mapping so adding types is explicit","Cover each DataType with protocol serialization tests"],"tags":["rust","postgresql","type-mapping","arrays"],"backgroundTag":"unsupported-data-type","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}