risingwavelabs/risingwave · error

The source with properties does not contain 'database.name'

Error message

The source with properties does not contain 'database.name'

What it means

`derive_with_options_for_cdc_table` requires the CDC source's `with` options to include the key `database.name`, used to validate the database prefix of the upstream table name in the FROM clause. When the source definition omits it, resolution of the external table name cannot proceed and an error is returned.

Source

Thrown at src/frontend/src/handler/create_table.rs:1000

    ))
}

/// Derive connector properties and normalize `external_table_name` for CDC tables.
///
/// Returns (`connector_properties`, `normalized_external_table_name`) where:
/// - For SQL Server: Normalizes 'db.schema.table' (3 parts) to 'schema.table' (2 parts),
///   because users can optionally include database name for verification, but it needs to be
///   stripped to match the format returned by Debezium's `extract_table_name()`.
/// - For MySQL/Postgres: Returns the original `external_table_name` unchanged.
fn derive_with_options_for_cdc_table(
    source_with_properties: &WithOptionsSecResolved,
    external_table_name: String,
) -> Result<(WithOptionsSecResolved, String)> {
    use source::cdc::{MYSQL_CDC_CONNECTOR, POSTGRES_CDC_CONNECTOR, SQL_SERVER_CDC_CONNECTOR};
    // we should remove the prefix from `full_table_name`
    let source_database_name: &str = source_with_properties
        .get("database.name")
        .ok_or_else(|| anyhow!("The source with properties does not contain 'database.name'"))?
        .as_str();
    let mut with_options = source_with_properties.clone();
    if let Some(connector) = source_with_properties.get(UPSTREAM_SOURCE_KEY) {
        match connector.as_str() {
            MYSQL_CDC_CONNECTOR => {
                // MySQL doesn't allow '.' in database name and table name, so we can split the
                // external table name by '.' to get the table name
                let (db_name, table_name) = external_table_name.split_once('.').ok_or_else(|| {
                    anyhow!("The upstream table name must contain database name prefix, e.g. 'database.table'")
                })?;
                // We allow multiple database names in the source definition
                if !source_database_name
                    .split(',')
                    .map(|s| s.trim())
                    .any(|name| name == db_name)
                {
                    return Err(anyhow!(
                        "The database name `{}` in the FROM clause is not included in the database name `{}` in source definition",

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Recreate or ALTER the source to include `'database.name' = '<db>'` in its WITH options.
  2. Verify the connector is one of the CDC connectors and that required keys (database.name, hostname, etc.) are present before creating the table.
  3. If the source is for SQL Server/Postgres, ensure the key name is exactly `database.name` (dot-separated), not `database_name`.

Example fix

-- before
CREATE SOURCE s WITH (connector='mysql-cdc', hostname='h', table.name='t');
-- after
CREATE SOURCE s WITH (connector='mysql-cdc', hostname='h', database.name='mydb', table.name='t');
Defensive patterns

Strategy: validation

Validate before calling

fn ensure_db_name(props: &WithOptionsSecResolved) -> Result<&str, String> {
    props.get("database.name")
        .map(|s| s.as_str())
        .ok_or_else(|| "CDC source missing 'database.name' in WITH options".into())
}

Prevention

When it happens

Trigger: `CREATE TABLE t (...) FROM cdc_source TABLE ...` where `cdc_source` was created without `database.name` in its properties (for MySQL/Postgres/SQL Server CDC connectors), or a REPLACE TABLE flow (`generate_stream_graph_for_replace_table`) hitting the same source.

Common situations: Hand-edited source definitions missing `database.name`; sources created by older tooling before the key became required; copy-pasted WITH clauses dropping the field.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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