Add safety assertion

This commit is contained in:
János Benjamin Antal 2024-08-28 13:20:58 +00:00
parent 3c6b2a48c3
commit a0fa693f0b

View File

@ -736,6 +736,7 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
{
if (!command_col_decl)
return;
const auto & column_decl = command_col_decl->as<const ASTColumnDeclaration &>();
if (!column_decl.children.empty() || column_decl.null_modifier.has_value() || !column_decl.default_specifier.empty()
@ -791,6 +792,11 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
}
}
command->type = ASTAlterCommand::MODIFY_COLUMN;
/// Make sure that type is not populated when REMOVE/MODIFY SETTING/RESET SETTING is used, because we wouldn't modify the type, which can be confusing
chassert(
nullptr == command_col_decl->as<const ASTColumnDeclaration &>().type
|| (command->remove_property.empty() && nullptr == command_settings_changes && nullptr == command_settings_resets));
}
else if (s_modify_order_by.ignore(pos, expected))
{