risingwavelabs/risingwave · error · anyhow::Error

nested array type is not supported

Error message

nested array type is not supported

What it means

When mapping a SeaQuery column type to a PostgreSQL type for the Postgres sink connector, array-of-array columns (e.g. INTEGER[][]) cannot be represented. The mapper explicitly rejects SeaType::Array wrapping another Array with this error because Postgres has no native multidimensional array wire type that this sink supports.

Source

Thrown at src/connector/src/connector_common/postgres.rs:827

                SeaType::Numeric(_) => Ok(PgType::NUMERIC_ARRAY),
                SeaType::Real => Ok(PgType::FLOAT4_ARRAY),
                SeaType::DoublePrecision => Ok(PgType::FLOAT8_ARRAY),
                SeaType::Varchar(_) => Ok(PgType::VARCHAR_ARRAY),
                SeaType::Char(_) => Ok(PgType::CHAR_ARRAY),
                SeaType::Text => Ok(PgType::TEXT_ARRAY),
                SeaType::Bytea => Ok(PgType::BYTEA_ARRAY),
                SeaType::Timestamp(_) => Ok(PgType::TIMESTAMP_ARRAY),
                SeaType::TimestampWithTimeZone(_) => Ok(PgType::TIMESTAMPTZ_ARRAY),
                SeaType::Date => Ok(PgType::DATE_ARRAY),
                SeaType::Time(_) => Ok(PgType::TIME_ARRAY),
                SeaType::TimeWithTimeZone(_) => Ok(PgType::TIMETZ_ARRAY),
                SeaType::Interval(_) => Ok(PgType::INTERVAL_ARRAY),
                SeaType::Boolean => Ok(PgType::BOOL_ARRAY),
                SeaType::Point => Ok(PgType::POINT_ARRAY),
                SeaType::Uuid => Ok(PgType::UUID_ARRAY),
                SeaType::Json => Ok(PgType::JSON_ARRAY),
                SeaType::JsonBinary => Ok(PgType::JSONB_ARRAY),
                SeaType::Array(_) => bail!("nested array type is not supported"),
                SeaType::Unknown(name) => {
                    // Treat as enum type
                    Ok(PgType::new(
                        name.clone(),
                        0,
                        PgKind::Array(PgType::new(
                            name.clone(),
                            0,
                            PgKind::Enum(vec![]),
                            "".into(),
                        )),
                        "".into(),
                    ))
                }
                _ => bail!("unsupported array type: {:?}", t),
            }
        }
        SeaType::Unknown(name) => {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Flatten the nested array into a single-level array before sinking (e.g. unnest and re-aggregate, or store as JSONB)
  2. Change the column type to a supported type such as JSONB in the sink schema
  3. Sink to a target other than Postgres, or use a custom sink handler that serializes nested arrays

Example fix

// before
CREATE SINK s FROM mv WITH (connector='jdbc', ...); -- mv contains col INT[][]
// after
CREATE SINK s FROM (SELECT flatten_arr(col) AS col FROM mv) WITH (connector='jdbc', ...); -- col is INT[] or JSONB
Defensive patterns

Strategy: validation

Validate before calling

fn is_nested_array(t: &ColumnDesc) -> bool {
    matches!(t.data_type, DataType::List(inner) if matches!(&*inner, DataType::List(_)))
}
// before CREATE SINK: assert!(!is_nested_array(&col), "flatten nested arrays before pg sink");

Type guard

fn flatten_if_nested(v: Value) -> Value {
    match v { Value::List(rows) if rows.iter().all(|r| matches!(r, Value::List(_))) => Value::Json, v => v }
}

Prevention

When it happens

Trigger: Creating a RisingWave table/materialized view with a nested array column (array of arrays) and sinking it to a Postgres sink; the type_mapping step calls sea_type_to_pg_type and hits the SeaType::Array arm whose inner element is itself an array.

Common situations: Ingesting JSON or Protobuf data whose schema defines repeated/repeated fields (nested lists), or defining columns like INT[][] in RisingWave, then attempting a Postgres sink.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/7f01a6d8bbfb7397. Report an issue: GitHub.