From 76fc99ee001810db64170844eb08ff934a9203a0 Mon Sep 17 00:00:00 2001 From: taniabogatsch <44262898+taniabogatsch@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:11:32 +0100 Subject: [PATCH] improve struct to struct cast error message --- src/function/cast/struct_cast.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/function/cast/struct_cast.cpp b/src/function/cast/struct_cast.cpp index 3fbb46b5342..7bfb3c7944c 100644 --- a/src/function/cast/struct_cast.cpp +++ b/src/function/cast/struct_cast.cpp @@ -19,7 +19,8 @@ unique_ptr StructBoundCastData::BindStructToStructCast(BindCastIn for (idx_t i = 0; i < source_child_types.size(); i++) { if (!target_is_unnamed && !source_is_unnamed && !StringUtil::CIEquals(source_child_types[i].first, result_child_types[i].first)) { - throw TypeMismatchException(source, target, "Cannot cast STRUCTs with different names"); + throw TypeMismatchException(source, target, + "Cannot cast STRUCTs with different names. Are the fields in the same order?"); } auto child_cast = input.GetCastFunction(source_child_types[i].second, result_child_types[i].second); child_cast_info.push_back(std::move(child_cast));