@@ -12696,17 +12696,15 @@ namespace sqlite_orm {
1269612696 constexpr decltype(auto) materialize_column_pointer(const DBOs&,
1269712697 const column_pointer<Moniker, alias_holder<ColAlias>>&) {
1269812698 using table_type = storage_pick_table_t<Moniker, DBOs>;
12699- using cte_mapper_type = cte_mapper_type_t<table_type>;
12699+ using cte_colrefs_tuple = typename cte_mapper_type_t<table_type>::final_colrefs_tuple;
12700+ using cte_fields_type = typename cte_mapper_type_t<table_type>::fields_type;
1270012701
1270112702 // lookup ColAlias in the final column references
12702- using colalias_index =
12703- find_tuple_type<typename cte_mapper_type::final_colrefs_tuple, alias_holder<ColAlias>>;
12704- static_assert(colalias_index::value < std::tuple_size_v<typename cte_mapper_type::final_colrefs_tuple>,
12703+ using colalias_index = find_tuple_type<cte_colrefs_tuple, alias_holder<ColAlias>>;
12704+ static_assert(colalias_index::value < std::tuple_size_v<cte_colrefs_tuple>,
1270512705 "No such column mapped into the CTE.");
1270612706
12707- return &aliased_field<
12708- ColAlias,
12709- std::tuple_element_t<colalias_index::value, typename cte_mapper_type::fields_type>>::field;
12707+ return &aliased_field<ColAlias, std::tuple_element_t<colalias_index::value, cte_fields_type>>::field;
1271012708 }
1271112709#endif
1271212710
@@ -12730,14 +12728,13 @@ namespace sqlite_orm {
1273012728 constexpr decltype(auto) find_column_name(const DBOs& dboObjects,
1273112729 const column_pointer<Moniker, alias_holder<ColAlias>>&) {
1273212730 using table_type = storage_pick_table_t<Moniker, DBOs>;
12733- using cte_mapper_type = cte_mapper_type_t<table_type>;
12731+ using cte_colrefs_tuple = typename cte_mapper_type_t<table_type>::final_colrefs_tuple ;
1273412732 using column_index_sequence = filter_tuple_sequence_t<elements_type_t<table_type>, is_column>;
1273512733
1273612734 // note: even though the columns contain the [`aliased_field<>::*`] we perform the lookup using the column references.
1273712735 // lookup ColAlias in the final column references
12738- using colalias_index =
12739- find_tuple_type<typename cte_mapper_type::final_colrefs_tuple, alias_holder<ColAlias>>;
12740- static_assert(colalias_index::value < std::tuple_size_v<typename cte_mapper_type::final_colrefs_tuple>,
12736+ using colalias_index = find_tuple_type<cte_colrefs_tuple, alias_holder<ColAlias>>;
12737+ static_assert(colalias_index::value < std::tuple_size_v<cte_colrefs_tuple>,
1274112738 "No such column mapped into the CTE.");
1274212739
1274312740 // note: we could "materialize" the alias to an `aliased_field<>::*` and use the regular `table_t<>::find_column_name()` mechanism;
0 commit comments