risingwavelabs/risingwave · error · SinkError::SqlServer
unexpected downstream SQL Server type
Error message
unexpected downstream SQL Server type {sql_server_data_type} for Timestamptz What it means
When binding a Timestamptz parameter for the SQL Server sink, RisingWave inspects the downstream column's reported SQL Server type. If it is neither of the expected datetime types (datetimeoffset/datetime2 family), this error reports the actual downstream type string. It protects against silently writing timestamps with wrong precision or timezone semantics.
Solutions
- Alter the downstream column to `DATETIMEOFFSET`: `ALTER TABLE <schema>.<table> ALTER COLUMN <col> DATETIMEOFFSET;`.
- Recreate the target table with `DATETIMEOFFSET` for that column and restart the sink.
- Alternatively change the RisingWave column's type to Timestamp (non-tz) if `DATETIME2` semantics are acceptable.
- Check the reported type in the error message against the supported list in `bind_params` in src/connector/src/sink/sqlserver.rs.
Example fix
-- before CREATE TABLE dbo.orders (created_at DATETIME); -- after ALTER TABLE dbo.orders ALTER COLUMN created_at DATETIMEOFFSET;
Defensive patterns
Strategy: validation
Validate before calling
-- ensure timestamp columns use DATETIMEOFFSET downstream
SELECT c.name, ty.name AS type_name
FROM sys.columns c
JOIN sys.types ty ON ty.user_type_id = c.user_type_id
WHERE ty.name NOT IN ('datetimeoffset') AND c.name LIKE '%time%'; Try / catch
if let Err(e) = sink.validate().await {
if e.to_string().contains("for Timestamptz") {
alter_downstream_to_datetimeoffset();
} else { return Err(e); }
} Prevention
- Always use DATETIMEOFFSET for tz-aware columns in downstream DDL
- Avoid legacy DATETIME defaults for new tables
- Re-validate sinks after downstream type migrations
When it happens
Trigger: `bind_params` on a Timestamptz column whose downstream SQL Server column type (from `query_sql_server_table_metadata`) is something unexpected — e.g. `datetime`, `smalldatetime`, `date`, or `varchar` — instead of the supported `datetimeoffset` type.
Common situations: Downstream table created manually with `DATETIME` (common legacy default); migrations downgraded a `DATETIMEOFFSET` column; sink pointed at an older schema created before the sink supported Timestamptz.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- column data type is incompatible with downstream SQL Server…
- Column ` ` in Postgres table ` ` has type ` `, but sink…
- column not found in the downstream SQL Server table
- column specified in primary_key mismatches with the…
- column type mismatch
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/d6bdc08fc6646f93.
Report an issue: GitHub.
Appendix: source
Thrown at src/connector/src/sink/sqlserver.rs:910
DataType::Variant => return Err(data_type_not_supported("Variant")),
DataType::Serial => return Err(data_type_not_supported("Serial")),
DataType::Int256 => return Err(data_type_not_supported("Int256")),
DataType::Map(_) => return Err(data_type_not_supported("Map")),
DataType::Vector(_) => return Err(data_type_not_supported("Vector")),
},
};
}
Ok(())
}
fn data_type_not_supported(data_type_name: &str) -> SinkError {
SinkError::SqlServer(anyhow!(format!(
"{data_type_name} is not supported in SQL Server"
)))
}
fn unexpected_downstream_timestamptz_type(sql_server_data_type: &str) -> SinkError {
SinkError::SqlServer(anyhow!(format!(
"unexpected downstream SQL Server type {sql_server_data_type} for Timestamptz"
)))
}
fn check_data_type_compatibility(data_type: &DataType) -> Result<()> {
match data_type {
DataType::Boolean
| DataType::Int16
| DataType::Int32
| DataType::Int64
| DataType::Float32
| DataType::Float64
| DataType::Decimal
| DataType::Date
| DataType::Varchar
| DataType::Time
| DataType::Timestamp
| DataType::TimestamptzView on GitHub (pinned to 6469eb736d)