@@ -213,10 +213,13 @@ namespace sqlpp
213
213
static_assert (has_result_row_t <derived_statement_t <Policies>>::value,
214
214
" left hand side argument of a union has to be a complete select statement or union" );
215
215
216
- using _result_row_t = get_result_row_t <Rhs>;
217
- static_assert (std::is_same<get_result_row_t <derived_statement_t <Policies>>, _result_row_t >::value,
216
+ using lhs_result_row_t = get_result_row_t <derived_statement_t <Policies>>;
217
+ using rhs_result_row_t = get_result_row_t <Rhs>;
218
+ static_assert (lhs_result_row_t::is_compatible (detail::type_vector<rhs_result_row_t >{}),
218
219
" both arguments in a union have to have the same result columns (type and name)" );
219
- static_assert (is_static_result_row_t <_result_row_t >::value, " unions must not have dynamically added columns" );
220
+ static_assert (
221
+ is_static_result_row_t <lhs_result_row_t >::value && is_static_result_row_t <rhs_result_row_t >::value,
222
+ " unions must not have dynamically added columns" );
220
223
221
224
return _union_impl<void , union_distinct_t >(check_union_t <derived_statement_t <Policies>, Rhs>{}, rhs);
222
225
}
@@ -231,10 +234,13 @@ namespace sqlpp
231
234
static_assert (has_result_row_t <derived_statement_t <Policies>>::value,
232
235
" left hand side argument of a union has to be a (complete) select statement" );
233
236
234
- using _result_row_t = get_result_row_t <Rhs>;
235
- static_assert (std::is_same<get_result_row_t <derived_statement_t <Policies>>, _result_row_t >::value,
237
+ using lhs_result_row_t = get_result_row_t <derived_statement_t <Policies>>;
238
+ using rhs_result_row_t = get_result_row_t <Rhs>;
239
+ static_assert (lhs_result_row_t::is_compatible (detail::type_vector<rhs_result_row_t >{}),
236
240
" both arguments in a union have to have the same result columns (type and name)" );
237
- static_assert (is_static_result_row_t <_result_row_t >::value, " unions must not have dynamically added columns" );
241
+ static_assert (
242
+ is_static_result_row_t <lhs_result_row_t >::value && is_static_result_row_t <rhs_result_row_t >::value,
243
+ " unions must not have dynamically added columns" );
238
244
239
245
return _union_impl<void , union_all_t >(check_union_t <derived_statement_t <Policies>, Rhs>{}, rhs);
240
246
}
0 commit comments