{"record":{"id":"d02e2f8a10eff11c","repo":"risingwavelabs/risingwave","slug":"invalid-table-name-format-for-sql-server-cdc","errorCode":null,"errorMessage":"Invalid table name format '{}'. For SQL Server CDC, you must specify the schema name. Use 'schema.table' format (e.g., 'dbo.{}') or 'database.schema.table' format (e.g., '{}.dbo.{}').","messagePattern":"Invalid table name format '(.+?)'\\. For SQL Server CDC, you must specify the schema name\\. Use 'schema\\.table' format \\(e\\.g\\., 'dbo\\.(.+?)'\\) or 'database\\.schema\\.table' format \\(e\\.g\\., '(.+?)\\.dbo\\.(.+?)'\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/frontend/src/handler/create_table.rs","lineNumber":1075,"sourceCode":"                                \"The database name '{}' in FROM clause does not match the database name '{}' specified in source definition. \\\n                                 You can either use 'schema.table' format (recommended) or ensure the database name matches.\",\n                                db_name,\n                                source_database_name\n                            ).into());\n                        }\n                        (schema_name, table_name)\n                    }\n                    2 => {\n                        // Format: schema.table (recommended)\n                        // Database name is taken from source definition\n                        let schema_name = parts[0];\n                        let table_name = parts[1];\n                        (schema_name, table_name)\n                    }\n                    1 => {\n                        // Format: table only\n                        // Reject with clear error message\n                        return Err(anyhow!(\n                            \"Invalid table name format '{}'. For SQL Server CDC, you must specify the schema name. \\\n                             Use 'schema.table' format (e.g., 'dbo.{}') or 'database.schema.table' format (e.g., '{}.dbo.{}').\",\n                            external_table_name,\n                            external_table_name,\n                            source_database_name,\n                            external_table_name\n                        ).into());\n                    }\n                    _ => {\n                        // Invalid format (4+ parts or empty)\n                        return Err(anyhow!(\n                            \"Invalid table name format '{}'. Expected 'schema.table' or 'database.schema.table'.\",\n                            external_table_name\n                        ).into());\n                    }\n                };\n\n                // Insert schema and table names into connector properties","sourceCodeStart":1057,"sourceCodeEnd":1093,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/handler/create_table.rs#L1057-L1093","documentation":"RisingWave rejects a SQL Server CDC `CREATE TABLE ... WITH (table_name = ...)` whose external table name has no schema component. `derive_with_options_for_cdc_table` splits the name on '.' and expects exactly 2 parts ('schema.table') or 3 parts ('database.schema.table'); a bare table name (1 part) is rejected because SQL Server CDC requires a schema to locate the source table and to build a unique Debezium topic identifier. The message shows concrete examples using the connector's actual source database name.","triggerScenarios":"Running CREATE TABLE with connector = 'sqlserver-cdc' (or sqlserver) and an externaltables/table_name option like 'customers', 'dbo.customers' is fine, but 'customers' alone hits the 1-part branch at create_table.rs:1075.","commonSituations":"Users coming from Postgres CDC habits (where 'public.table' is sometimes assumed) omit the schema; copying a MySQL-style connection string that omits schema; scripts generating DDL from a table list without schema qualification.","solutions":["Change the table_name/externaltables option to include the schema: 'dbo.customers'.","If a different database is needed, use the 3-part form 'mydb.dbo.customers'.","Verify the schema exists in the SQL Server database and that the CDC user has SELECT/CDC permissions on it.","If the name contains special characters, keep it as a single quoted option value; the split is on '.' so escaped dots are not supported."],"exampleFix":"// before\nWITH (\n  connector = 'sqlserver-cdc',\n  table_name = 'customers'\n)\n// after\nWITH (\n  connector = 'sqlserver-cdc',\n  table_name = 'dbo.customers'\n)","handlingStrategy":"validation","validationCode":"function validateSqlServerCdcTableName(name) {\n  const parts = name.split('.');\n  return parts.length === 2 || parts.length === 3;\n}\n// validateSqlServerCdcTableName('dbo.customers') === true\n// validateSqlServerCdcTableName('customers') === false -> fix before DDL","typeGuard":"const isQualified = (n) => typeof n === 'string' && [2, 3].includes(n.split('.').length) && n.split('.').every(p => p.length > 0);","tryCatchPattern":null,"preventionTips":["Always write SQL Server CDC table names fully schema-qualified ('dbo.xxx').","Centralize table-name construction in a helper that appends the schema when missing.","Add a lint/unit test on DDL generators that enforces 2- or 3-part names."],"tags":["cdc","sql-server","table-name-format","frontend"],"backgroundTag":"invalid-argument-format","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}