diff --git a/src/sqlparser/src/ast/statement.rs b/src/sqlparser/src/ast/statement.rs index 0c5d0bd87191..3f437d6d6034 100644 --- a/src/sqlparser/src/ast/statement.rs +++ b/src/sqlparser/src/ast/statement.rs @@ -377,12 +377,10 @@ impl ParseTo for CreateSourceStatement { .find(|&opt| opt.name.real_value() == UPSTREAM_SOURCE_KEY); let connector: String = option.map(|opt| opt.value.to_string()).unwrap_or_default(); let cdc_source_job = connector.contains("-cdc"); - if cdc_source_job { - if !columns.is_empty() || !constraints.is_empty() { - return Err(ParserError::ParserError( - "CDC source cannot define columns and constraints".to_string(), - )); - } + if cdc_source_job && (!columns.is_empty() || !constraints.is_empty()) { + return Err(ParserError::ParserError( + "CDC source cannot define columns and constraints".to_string(), + )); } // row format for nexmark source must be native