{"record":{"id":"255012eb211209e6","repo":"risingwavelabs/risingwave","slug":"the-source-with-properties-does-not-contain-datab","errorCode":null,"errorMessage":"The source with properties does not contain 'database.name'","messagePattern":"The source with properties does not contain 'database\\.name'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/frontend/src/handler/create_table.rs","lineNumber":1000,"sourceCode":"    ))\n}\n\n/// Derive connector properties and normalize `external_table_name` for CDC tables.\n///\n/// Returns (`connector_properties`, `normalized_external_table_name`) where:\n/// - For SQL Server: Normalizes 'db.schema.table' (3 parts) to 'schema.table' (2 parts),\n///   because users can optionally include database name for verification, but it needs to be\n///   stripped to match the format returned by Debezium's `extract_table_name()`.\n/// - For MySQL/Postgres: Returns the original `external_table_name` unchanged.\nfn derive_with_options_for_cdc_table(\n    source_with_properties: &WithOptionsSecResolved,\n    external_table_name: String,\n) -> Result<(WithOptionsSecResolved, String)> {\n    use source::cdc::{MYSQL_CDC_CONNECTOR, POSTGRES_CDC_CONNECTOR, SQL_SERVER_CDC_CONNECTOR};\n    // we should remove the prefix from `full_table_name`\n    let source_database_name: &str = source_with_properties\n        .get(\"database.name\")\n        .ok_or_else(|| anyhow!(\"The source with properties does not contain 'database.name'\"))?\n        .as_str();\n    let mut with_options = source_with_properties.clone();\n    if let Some(connector) = source_with_properties.get(UPSTREAM_SOURCE_KEY) {\n        match connector.as_str() {\n            MYSQL_CDC_CONNECTOR => {\n                // MySQL doesn't allow '.' in database name and table name, so we can split the\n                // external table name by '.' to get the table name\n                let (db_name, table_name) = external_table_name.split_once('.').ok_or_else(|| {\n                    anyhow!(\"The upstream table name must contain database name prefix, e.g. 'database.table'\")\n                })?;\n                // We allow multiple database names in the source definition\n                if !source_database_name\n                    .split(',')\n                    .map(|s| s.trim())\n                    .any(|name| name == db_name)\n                {\n                    return Err(anyhow!(\n                        \"The database name `{}` in the FROM clause is not included in the database name `{}` in source definition\",","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/handler/create_table.rs#L982-L1018","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"Hand-edited source definitions missing `database.name`; sources created by older tooling before the key became required; copy-pasted WITH clauses dropping the field.","solutions":["Recreate or ALTER the source to include `'database.name' = '<db>'` in its WITH options.","Verify the connector is one of the CDC connectors and that required keys (database.name, hostname, etc.) are present before creating the table.","If the source is for SQL Server/Postgres, ensure the key name is exactly `database.name` (dot-separated), not `database_name`."],"exampleFix":"-- before\nCREATE SOURCE s WITH (connector='mysql-cdc', hostname='h', table.name='t');\n-- after\nCREATE SOURCE s WITH (connector='mysql-cdc', hostname='h', database.name='mydb', table.name='t');","handlingStrategy":"validation","validationCode":"fn ensure_db_name(props: &WithOptionsSecResolved) -> Result<&str, String> {\n    props.get(\"database.name\")\n        .map(|s| s.as_str())\n        .ok_or_else(|| \"CDC source missing 'database.name' in WITH options\".into())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include database.name when creating MySQL/Postgres/SQL Server CDC sources","Use exact dot-separated key names, not snake_case variants","Validate source WITH options against the connector's required-key list before creating tables from it"],"tags":["rust","cdc","validation","missing-key"],"backgroundTag":"missing-required-config-field","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}