{"record":{"id":"308ef30c26b3bbf4","repo":"risingwavelabs/risingwave","slug":"dont-support-auto-create-table-for-datatype","errorCode":null,"errorMessage":"Dont support auto create table for datatype: {}","messagePattern":"Dont support auto create table for datatype: (.+?)","errorType":"validation","errorClass":"SinkError::Config","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/snowflake_redshift/redshift.rs","lineNumber":878,"sourceCode":"    let data_type = match data_type {\n        DataType::Int16 => \"SMALLINT\".to_owned(),\n        DataType::Int32 => \"INTEGER\".to_owned(),\n        DataType::Int64 => \"BIGINT\".to_owned(),\n        DataType::Float32 => \"REAL\".to_owned(),\n        DataType::Float64 => \"FLOAT\".to_owned(),\n        DataType::Boolean => \"BOOLEAN\".to_owned(),\n        DataType::Varchar => \"VARCHAR(MAX)\".to_owned(),\n        DataType::Date => \"DATE\".to_owned(),\n        DataType::Timestamp => \"TIMESTAMP\".to_owned(),\n        DataType::Timestamptz => \"TIMESTAMPTZ\".to_owned(),\n        DataType::Jsonb => \"VARCHAR(MAX)\".to_owned(),\n        // Redshift's DECIMAL without explicit precision defaults to (38,0), which drops all\n        // fractional digits. We use DECIMAL(38, 10) consistent with the Iceberg/Snowflake sink\n        // convention, though values with more than 10 fractional digits may still lose precision.\n        DataType::Decimal => \"DECIMAL(38, 10)\".to_owned(),\n        DataType::Time => \"TIME\".to_owned(),\n        _ => {\n            return Err(SinkError::Config(anyhow!(\n                \"Dont support auto create table for datatype: {}\",\n                data_type\n            )));\n        }\n    };\n    Ok(data_type)\n}\n\nfn build_create_merge_into_task_sql(\n    cdc_schema_name: Option<&str>,\n    target_schema_name: Option<&str>,\n    cdc_table_name: &str,\n    target_table_name: &str,\n    pk_column_names: &Vec<String>,\n    all_column_names: &Vec<String>,\n) -> Vec<String> {\n    let cdc_table_name = build_full_table_name(cdc_schema_name, cdc_table_name);\n    let target_table_name = build_full_table_name(target_schema_name, target_table_name);","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/snowflake_redshift/redshift.rs#L860-L896","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Remove or cast the unsupported column before sinking (e.g. cast JSONB to VARCHAR).","Pre-create the Redshift table manually with compatible types and disable auto table creation.","Extend `convert_redshift_data_type` with a mapping if your fork needs the type."],"exampleFix":"// before\nALTER TABLE t ADD COLUMN extra JSONB;\n-- after\nALTER TABLE t ADD COLUMN extra VARCHAR;\nCREATE SINK s FROM t WITH (connector='redshift', ...);","handlingStrategy":"validation","validationCode":"fn redshift_compatible(dt: &DataType) -> bool {\n    !matches!(dt, DataType::Struct(_) | DataType::Jsonb | DataType::Bytea | DataType::List(_) | DataType::Map(_))\n}","typeGuard":"fn is_supported(dt: &DataType) -> bool {\n    matches!(dt,\n        DataType::Boolean | DataType::Int16 | DataType::Int32 | DataType::Int64 |\n        DataType::Float32 | DataType::Float64 | DataType::Decimal |\n        DataType::Varchar | DataType::Date | DataType::Time | DataType::Timestamp |\n        DataType::Timestamptz)\n}","tryCatchPattern":null,"preventionTips":["Cast complex columns to VARCHAR before sinking to Redshift.","Pre-create the target table with explicit types if schema contains non-primitive types."],"tags":["rust","redshift","datatype","auto-create-table"],"backgroundTag":"unsupported-dtype","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}