risingwavelabs/risingwave · error · SinkError::Config

Dont support auto create table for datatype

Error message

Dont support auto create table for datatype: {}

What it means

`convert_redshift_data_type` maps RisingWave `DataType`s to Redshift column types when auto-creating tables or adding columns. If the datatype falls through the match (e.g. Struct, Jsonb, Bytea, List, Map), Redshift sink cannot auto-create a compatible column and throws this Config error, naming the unsupported datatype.

Solutions

  1. Remove or cast the unsupported column before sinking (e.g. cast JSONB to VARCHAR).
  2. Pre-create the Redshift table manually with compatible types and disable auto table creation.
  3. Extend `convert_redshift_data_type` with a mapping if your fork needs the type.

Example fix

// before
ALTER TABLE t ADD COLUMN extra JSONB;
-- after
ALTER TABLE t ADD COLUMN extra VARCHAR;
CREATE SINK s FROM t WITH (connector='redshift', ...);
Defensive patterns

Strategy: validation

Validate before calling

fn redshift_compatible(dt: &DataType) -> bool {
    !matches!(dt, DataType::Struct(_) | DataType::Jsonb | DataType::Bytea | DataType::List(_) | DataType::Map(_))
}

Type guard

fn is_supported(dt: &DataType) -> bool {
    matches!(dt,
        DataType::Boolean | DataType::Int16 | DataType::Int32 | DataType::Int64 |
        DataType::Float32 | DataType::Float64 | DataType::Decimal |
        DataType::Varchar | DataType::Date | DataType::Time | DataType::Timestamp |
        DataType::Timestamptz)
}

Prevention

When it happens

Trigger: `build_create_table_sql` or `commit_schema_change` (AddColumns) encounters a column whose `DataType` has no Redshift mapping, e.g. adding a `STRUCT`/`JSONB` column to a materialized view feeding a Redshift sink with auto table creation.

Common situations: User adds a nested/complex-typed column (`STRUCT`, `LIST`, `MAP`, `JSONB`, `BYTEA`) to the source table; default-value columns of exotic types; type widening changes introducing unsupported types.

Related errors


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

Appendix: source

Thrown at src/connector/src/sink/snowflake_redshift/redshift.rs:878

    let data_type = match data_type {
        DataType::Int16 => "SMALLINT".to_owned(),
        DataType::Int32 => "INTEGER".to_owned(),
        DataType::Int64 => "BIGINT".to_owned(),
        DataType::Float32 => "REAL".to_owned(),
        DataType::Float64 => "FLOAT".to_owned(),
        DataType::Boolean => "BOOLEAN".to_owned(),
        DataType::Varchar => "VARCHAR(MAX)".to_owned(),
        DataType::Date => "DATE".to_owned(),
        DataType::Timestamp => "TIMESTAMP".to_owned(),
        DataType::Timestamptz => "TIMESTAMPTZ".to_owned(),
        DataType::Jsonb => "VARCHAR(MAX)".to_owned(),
        // Redshift's DECIMAL without explicit precision defaults to (38,0), which drops all
        // fractional digits. We use DECIMAL(38, 10) consistent with the Iceberg/Snowflake sink
        // convention, though values with more than 10 fractional digits may still lose precision.
        DataType::Decimal => "DECIMAL(38, 10)".to_owned(),
        DataType::Time => "TIME".to_owned(),
        _ => {
            return Err(SinkError::Config(anyhow!(
                "Dont support auto create table for datatype: {}",
                data_type
            )));
        }
    };
    Ok(data_type)
}

fn build_create_merge_into_task_sql(
    cdc_schema_name: Option<&str>,
    target_schema_name: Option<&str>,
    cdc_table_name: &str,
    target_table_name: &str,
    pk_column_names: &Vec<String>,
    all_column_names: &Vec<String>,
) -> Vec<String> {
    let cdc_table_name = build_full_table_name(cdc_schema_name, cdc_table_name);
    let target_table_name = build_full_table_name(target_schema_name, target_table_name);

View on GitHub (pinned to 6469eb736d)