risingwavelabs/risingwave · error

unsupported PostgreSQL snapshot list element type {elem}

Error message

unsupported PostgreSQL snapshot list element type {elem}

What it means

Raised when the element type of a RisingWave List column is Struct, a nested List, or Serial, which the PostgreSQL snapshot reader does not support decoding. The converter bails before attempting to read the cell; nested list support is an explicit TODO in the connector.

Source

Thrown at src/connector/src/parser/postgres.rs:203

                        .into_iter()
                        .map(Finite32::try_from)
                        .collect::<Result<Vec<_>, _>>()
                        .map_err(anyhow::Error::msg)
                        .with_context(|| {
                            format!(
                                "PostgreSQL snapshot column `{name}` contains a non-finite vector \
                                 element"
                            )
                        })?;
                    Ok(Some(ScalarImpl::Vector(VectorVal::from(finite))))
                }
                None => Ok(None),
            }
        }
        DataType::List(list) => match list.elem() {
            // TODO(Kexiang): allow DataType::List(_)
            elem @ (DataType::Struct(_) | DataType::List(_) | DataType::Serial) => {
                bail!("unsupported PostgreSQL snapshot list element type {elem}")
            }
            _ => {
                match row
                    .try_get::<_, Option<ScalarAdapter>>(i)
                    .with_context(|| {
                        format!("failed to decode PostgreSQL snapshot list column `{name}`")
                    })? {
                    Some(value) => value.into_scalar(data_type).map(Some).ok_or_else(|| {
                        anyhow!(
                            "failed to convert PostgreSQL snapshot column `{name}` to {data_type}"
                        )
                    }),
                    None => Ok(None),
                }
            }
        },
        DataType::Serial | DataType::Map(_) | DataType::Variant => {
            bail!("unsupported PostgreSQL snapshot data type {data_type} for column `{name}`")

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Flatten the schema: replace the nested list/struct-list column with a supported element type or model the nesting as a separate table/JSON.
  2. Re-create the RW table with a supported list element type (scalars, enums).
  3. Cast the Postgres column to text/JSON in the source query and read it as a varchar/JSON column.
  4. Upgrade to a version with nested-list support or track the TODO in the connector.

Example fix

// before
CREATE TABLE t (rows array<struct<a int>>) FROM pg ...;
// after: supported scalar element type
CREATE TABLE t (rows array<int>) FROM pg ...;
Defensive patterns

Strategy: validation

Validate before calling

// Before creating the table, verify list element types are supported:
// RW list elem must not be Struct, List, or Serial for PG snapshot reads.
fn has_unsupported_list_elem(dt: &DataType) -> bool {
    matches!(dt, DataType::List(l) if matches!(
        l.elem(), DataType::Struct(_) | DataType::List(_) | DataType::Serial))
}

Type guard

fn has_unsupported_list_elem(dt: &DataType) -> bool {
    matches!(dt, DataType::List(l) if matches!(
        l.elem(), DataType::Struct(_) | DataType::List(_) | DataType::Serial))
}

Try / catch

match result {
    Err(e) if e.to_string().contains("unsupported PostgreSQL snapshot list element type") => {
        // recreate table with a supported element type or model as JSON
    }
    other => other?,
}

Prevention

When it happens

Trigger: `postgres_cell_to_scalar_impl_strict` matches a `DataType::List` column whose `elem()` is `Struct(_)`, `List(_)`, or `Serial` during snapshot reads (`postgres_row_to_owned_row_with_strict_pk` and the split-bound helpers).

Common situations: Creating an RW table over Postgres with `array<struct<...>>`, `array<array<...>>`, or `array<serial>` columns; schema inference mapping a Postgres composite array to a struct list; upstream type changed after the table was created.

Related errors


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