risingwavelabs/risingwave · error · ConnectorError

Unsupported Sql Server data type

Error message

Unsupported Sql Server data type: {:?}, column name: {}

What it means

SqlServer CDC schema mapping fails when a source column has a SQL Server data type that has no RisingWave DataType mapping in `mssql_type_to_rw_type`. The function matches a fixed whitelist of type names (ints, decimals, date/time, strings, money, etc.) and bails for anything else so unknown data is never silently mis-typed.

Solutions

  1. Drop or exclude the unsupported column from the CDC table (create a view or a table without it).
  2. ALTER the column to a supported equivalent, e.g. varbinary -> varchar (base64/hex), geography -> varchar.
  3. Add a mapping arm for the type in `mssql_type_to_rw_type` in src/connector/src/source/cdc/external/sql_server.rs and rebuild.

Example fix

// before
mssql_type => {
    return Err(anyhow!("Unsupported Sql Server data type: {:?}, column name: {}", mssql_type, col_name).into());
}
// after (support binary types as varchar via hex)
"binary" | "varbinary" | "image" => DataType::Varchar,
mssql_type => {
    return Err(anyhow!("Unsupported Sql Server data type: {:?}, column name: {}", mssql_type, col_name).into());
}
Defensive patterns

Strategy: validation

Validate before calling

-- Before creating the CDC source, check column types:
SELECT name, system_type_id, TYPE_NAME(system_type_id) AS type_name
FROM sys.columns WHERE object_id = OBJECT_ID('dbo.mytable');
-- Ensure every type is in the supported set: tinyint,smallint,int,bigint,bit,decimal,numeric,
-- float,real,date,time,datetime,datetime2,smalldatetime,datetimeoffset,char,nchar,varchar,nvarchar,text,ntext,xml,uniqueidentifier,money,smallmoney

Prevention

When it happens

Trigger: CDC source on a SQL Server table whose column type is not in the whitelist, e.g. `hierarchyid`, `geography`, `geometry`, `sql_variant`, `binary`/`varbinary`/`image`, `timestamp`/`rowversion`, `bit` variants or user-defined types, discovered during `connect` while building the table schema.

Common situations: Syncing legacy SQL Server tables with spatial or binary columns; tables with rowversion columns used for optimistic concurrency; user-defined type aliases that resolve to unsupported base types.

Related errors


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

Appendix: source

Thrown at src/connector/src/source/cdc/external/sql_server.rs:205

fn mssql_type_to_rw_type(col_type: &str, col_name: &str) -> ConnectorResult<DataType> {
    let dtype = match col_type.to_lowercase().as_str() {
        "bit" => DataType::Boolean,
        "binary" | "varbinary" => DataType::Bytea,
        "tinyint" | "smallint" => DataType::Int16,
        "integer" | "int" => DataType::Int32,
        "bigint" => DataType::Int64,
        "real" => DataType::Float32,
        "float" => DataType::Float64,
        "decimal" | "numeric" => DataType::Decimal,
        "date" => DataType::Date,
        "time" => DataType::Time,
        "datetime" | "datetime2" | "smalldatetime" => DataType::Timestamp,
        "datetimeoffset" => DataType::Timestamptz,
        "char" | "nchar" | "varchar" | "nvarchar" | "text" | "ntext" | "xml"
        | "uniqueidentifier" => DataType::Varchar,
        "money" => DataType::Decimal,
        mssql_type => {
            return Err(anyhow!(
                "Unsupported Sql Server data type: {:?}, column name: {}",
                mssql_type,
                col_name
            )
            .into());
        }
    };
    Ok(dtype)
}

#[derive(Debug)]
pub struct SqlServerExternalTableReader {
    rw_schema: Schema,
    pk_indices: Vec<usize>,
    field_names: String,
    client: tokio::sync::Mutex<SqlServerClient>,
}

View on GitHub (pinned to 6469eb736d)