Skip to content

Commit 3e261c2

Browse files
committed
Fixes for recent Mz changes
1 parent 85e887a commit 3e261c2

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

expr.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ const_expr::const_expr(prod *p, sqltype *type_constraint)
323323
else if (type->name[0] == '_')
324324
expr = "array[null, null]::" + type->name.substr(1, type->name.size()) + "[]";
325325
else
326-
if (d6() == 1) {
326+
if (d6() < 4) {
327327
if (type->name == "int2")
328328
expr = "-32768::int2";
329329
else if (type->name == "int4")
@@ -337,12 +337,12 @@ const_expr::const_expr(prod *p, sqltype *type_constraint)
337337
else if (type->name == "uint8")
338338
expr = "0::uint8";
339339
else if (type->name == "float4")
340-
expr = "1E-37::float4";
340+
expr = "'inf'::float4";
341341
else if (type->name == "float8")
342-
expr = "'1E-307'::float8";
342+
expr = "'inf'::float8";
343343
else
344344
expr = "cast(0 as " + type->name + ")";
345-
} else if (d6() == 1) {
345+
} else if (d6() < 4) {
346346
if (type->name == "int2")
347347
expr = "32767::int2";
348348
else if (type->name == "int4")
@@ -356,9 +356,9 @@ const_expr::const_expr(prod *p, sqltype *type_constraint)
356356
else if (type->name == "uint8")
357357
expr = "18446744073709551615::uint8";
358358
else if (type->name == "float4")
359-
expr = "1E+37::float4";
359+
expr = "'nan'::float4";
360360
else if (type->name == "float8")
361-
expr = "'1E+307'::float8";
361+
expr = "'nan'::float8";
362362
else
363363
expr = "1::" + type->name;
364364
} else if (d6() == 1) {

grammar.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ void query_spec::out(std::ostream &out) {
255255
indent(out);
256256
out << "where ";
257257
out << *search;
258-
indent(out);
259-
out << "limit coalesce(";
260-
out << *limit;
261-
out << ", " << d100() + d100() << ")";
262258
}
263259

264260
struct for_update_verify : prod_visitor {
@@ -327,15 +323,12 @@ query_spec::query_spec(prod *p, struct scope *s, bool lateral) :
327323
if (lateral)
328324
scope->refs = s->refs;
329325

330-
limit = value_expr::factory(this, scope->schema->inttype, false);
331-
332326
from_clause = make_shared<struct from_clause>(this);
333327
select_list = make_shared<struct select_list>(this);
334328

335329
set_quantifier = (d100() == 1) ? "distinct" : "";
336330

337331
search = bool_expr::factory(this);
338-
//limit = make_shared<column_reference>(this, scope->schema->inttype);
339332
}
340333

341334
long prepare_stmt::seq;

grammar.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,11 @@ struct query_spec : prod {
134134
shared_ptr<struct from_clause> from_clause;
135135
shared_ptr<struct select_list> select_list;
136136
shared_ptr<bool_expr> search;
137-
shared_ptr<value_expr> limit;
138137
struct scope myscope;
139138
virtual void out(std::ostream &out);
140139
query_spec(prod *p, struct scope *s, bool lateral = 0);
141140
virtual void accept(prod_visitor *v) {
142141
v->visit(this);
143-
limit->accept(v);
144142
select_list->accept(v);
145143
from_clause->accept(v);
146144
search->accept(v);

postgres.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ void dut_pqxx::test(const std::string &stmt)
8585
try {
8686
pqxx::work w(c);
8787
w.exec("SET TRANSACTION_ISOLATION TO 'SERIALIZABLE'");
88-
//w.exec("SET CLUSTER_REPLICA = default.r1");
8988
w.exec(stmt.c_str());
9089
if (d6() < 4)
9190
w.abort();
@@ -334,6 +333,8 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog, bool dump_state
334333
"WHERE array_length(mz_operators.argument_type_ids, 1) = 2 "
335334
"AND mz_operators.name <> '<@' " // type system insufficient
336335
"AND mz_operators.name <> '@>' " // type system insufficient
336+
"AND mz_operators.name <> '<<' " // unknown operator for uint
337+
"AND mz_operators.name <> '>>' " // unknown operator for uint
337338
"UNION SELECT "
338339
"mz_operators.name AS oprname, "
339340
"0 as oprleft, "
@@ -342,7 +343,8 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog, bool dump_state
342343
"FROM mz_catalog.mz_operators "
343344
"JOIN mz_catalog.mz_types AS ret_type ON mz_operators.return_type_id = ret_type.id "
344345
"JOIN mz_catalog.mz_types AS right_type ON mz_operators.argument_type_ids[1] = right_type.id "
345-
"WHERE array_length(mz_operators.argument_type_ids, 1) = 1");
346+
"WHERE array_length(mz_operators.argument_type_ids, 1) = 1 "
347+
);
346348

347349
if (dump_state) {
348350
data["operators"] = json::array();
@@ -417,6 +419,7 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog, bool dump_state
417419
"AND (mz_functions.name <> 'sum' OR mz_functions.return_type_id <> (select id from mz_types where name = 'interval'))" // sum(interval) not yet supported, see https://github.com/MaterializeInc/materialize/issues/18043
418420
"AND (mz_functions.name <> 'timezone' OR mz_functions.argument_type_ids[2] <> (select id from mz_types where name = 'time'))" // timezone with time type is intentionally not supported, see https://github.com/MaterializeInc/materialize/pull/22960
419421
"AND mz_functions.name <> 'pretty_sql' " // Expected a keyword at the beginning of a statement, found ...
422+
"AND mz_functions.name <> 'map_build' " // map_build(text list) does not exist
420423
"AND NOT (" + procedure_is_aggregate + " or " + procedure_is_window + ") ");
421424

422425
if (dump_state) {
@@ -520,7 +523,7 @@ schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog, bool dump_state
520523
"AND NOT (mz_functions.name in ('sum', 'avg', 'avg_internal_v1') AND ret_type.oid = 1186) " // https://github.com/MaterializeInc/materialize/issues/18043
521524
"AND mz_functions.name <> 'array_agg' " // https://github.com/MaterializeInc/materialize/issues/18044
522525
"AND NOT (mz_functions.name = 'string_agg' AND ret_type.oid = 17) " // string_agg on BYTEA not yet supported
523-
"AND NOT mz_functions.name in ('mz_all', 'mz_any') " // https://github.com/MaterializeInc/materialize/issues/18057
526+
"AND NOT (mz_functions.name in ('mz_any', 'mz_all') " // https://github.com/MaterializeInc/database-issues/issues/9298
524527
"AND " + procedure_is_aggregate + " AND NOT " + procedure_is_window);
525528
for (auto row : r) {
526529
routine proc(row[0].as<string>(),

0 commit comments

Comments
 (0)