diff --git a/expr.cc b/expr.cc index 99640bf..5f62e92 100644 --- a/expr.cc +++ b/expr.cc @@ -17,9 +17,8 @@ using impedance::matched; shared_ptr value_expr::factory(prod *p, sqltype *type_constraint, bool can_return_set) { try { - // ERROR: aggregate window functions not yet supported - //if (1 == d20() && p->level < d6() && window_function::allowed(p)) - // return make_shared(p, type_constraint); + if (1 == d20() && p->level < d6() && window_function::allowed(p)) + return make_shared(p, type_constraint); if (1 == d42() && p->level < d6() && type_constraint && type_constraint->name.rfind("list", 0) != 0 && type_constraint->name.rfind("map", 0) != 0 && type_constraint->name.rfind("record", 0) != 0 && type_constraint->name.rfind("any", 0) != 0) return make_shared(p, type_constraint); else if (1 == d42() && p->level < d6() && type_constraint && type_constraint->name.rfind("list", 0) != 0 && type_constraint->name.rfind("map", 0) != 0 && type_constraint->name.rfind("record", 0) != 0 && type_constraint->name.rfind("any", 0) != 0) @@ -557,7 +556,7 @@ window_function::window_function(prod *p, sqltype *type_constraint) : value_expr(p) { match(); - aggregate = make_shared(this, type_constraint, true); + aggregate = make_shared(this, type_constraint, true, true); type = aggregate->type; partition_by.push_back(make_shared(this)); while(d6() > 4) diff --git a/grammar.cc b/grammar.cc index 542e829..8547fb0 100644 --- a/grammar.cc +++ b/grammar.cc @@ -800,7 +800,7 @@ void explain_stmt::out(std::ostream &out) { if (for_supported) { out << "for "; } - if(with_supported && d6() > 3) { + if(with_supported && d6() == 1) { out << "create materialized view mv as "; } out << *q; diff --git a/postgres.cc b/postgres.cc index ad20851..9b92c3c 100644 --- a/postgres.cc +++ b/postgres.cc @@ -344,8 +344,9 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog) : c(conninfo) "ON mz_functions.return_type_id = ret_type.id " "WHERE mz_functions.name not in ('pg_event_trigger_table_rewrite_reason', 'percentile_cont', 'dense_rank', 'cume_dist', 'rank', 'test_rank', 'percent_rank', 'percentile_disc', 'mode', 'test_percentile_disc') " "AND mz_functions.name !~ '^ri_fkey_' " - "AND NOT (mz_functions.name in ('sum', 'avg') AND ret_type.oid = 1186) " // https://github.com/MaterializeInc/materialize/issues/18043 + "AND NOT (mz_functions.name in ('sum', 'avg', 'avg_internal_v1') AND ret_type.oid = 1186) " // https://github.com/MaterializeInc/materialize/issues/18043 "AND mz_functions.name <> 'array_agg' " // https://github.com/MaterializeInc/materialize/issues/18044 + "AND (mz_functions.name <> 'string_agg' AND ret_type.oid = 17) " // string_agg on BYTEA not yet supported "AND NOT mz_functions.name in ('mz_all', 'mz_any') " // https://github.com/MaterializeInc/materialize/issues/18057 "AND " + procedure_is_aggregate + " AND NOT " + procedure_is_window); for (auto row : r) {