diff --git a/src/sqlgen/postgres/to_sql.cpp b/src/sqlgen/postgres/to_sql.cpp index c479ead..0eda2aa 100644 --- a/src/sqlgen/postgres/to_sql.cpp +++ b/src/sqlgen/postgres/to_sql.cpp @@ -751,6 +751,9 @@ std::string table_or_query_to_sql( return _table_or_query.visit([](const auto& _t) -> std::string { using Type = std::remove_cvref_t; if constexpr (std::is_same_v) { + if (_t.schema) { + return wrap_in_quotes(*_t.schema) + "." + wrap_in_quotes(_t.name); + } return wrap_in_quotes(_t.name); } else { return "(" + select_from_to_sql(*_t) + ")";