diff --git a/include/sqlpp11/without_table_check.h b/include/sqlpp11/without_table_check.h index 5d1fe46a..c7703a6f 100644 --- a/include/sqlpp11/without_table_check.h +++ b/include/sqlpp11/without_table_check.h @@ -27,9 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SQLPP_WITHOUT_TABLE_CHECK_H -#define SQLPP_ALIAS_H - #include #include @@ -61,12 +58,11 @@ namespace sqlpp template auto without_table_check(Expression expr) -> without_table_check_t { - static_assert(is_expression_t::value, "invalid argument (expression expected)"); + static_assert(is_expression_t::value or is_alias_t::value, + "invalid argument (expression or alias expression expected)"); return {expr}; } } // namespace sqlpp #endif - -#endif diff --git a/tests/SelectType.cpp b/tests/SelectType.cpp index f0781007..f783ce15 100644 --- a/tests/SelectType.cpp +++ b/tests/SelectType.cpp @@ -396,6 +396,12 @@ int SelectType(int, char* []) serialize(s, printer).str(); } + { + auto find_query = sqlpp::dynamic_select(db).dynamic_columns(t.alpha.as(alias::a)).dynamic_from(t).unconditionally(); + find_query.from.add(sqlpp::dynamic_join(f).on(t.alpha == f.omega)); + find_query.selected_columns.add(sqlpp::without_table_check(f.omega.as(alias::b))); + } + // Test that verbatim_table compiles { auto s = select(t.alpha).from(sqlpp::verbatim_table("my_unknown_table"));