Skip to content

Commit

Permalink
Remove workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Dec 7, 2023
1 parent 7377ce4 commit 55a1eba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
3 changes: 2 additions & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ grep -v "cannot return complex numbers" |
grep -v "unrecognized privilege type" |
grep -v "statement batch size cannot exceed" |
grep -v "operator does not exist" | # For list types
grep -v "does not exist" | # For roles
#grep -v "does not exist" | # For roles
# Refinement:
grep -v "value too long for type" |
grep -v "list_agg on char not yet supported" |
Expand Down Expand Up @@ -151,4 +151,5 @@ grep -v "arrays must not contain null values" |
grep -v "window functions are not allowed in table function arguments" |
grep -v "window functions are not allowed in OR argument" |
grep -v "window functions are not allowed in AND argument" |
grep -v "LIMIT must not be negative" |
sort | uniq -c | sort -n
18 changes: 7 additions & 11 deletions grammar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ void query_spec::out(std::ostream &out) {
indent(out);
out << "where ";
out << *search;
if (limit_clause.length()) {
indent(out);
out << limit_clause;
}
indent(out);
out << "limit coalesce(";
out << *limit;
out << ", " << d100() + d100() << ")";
}

struct for_update_verify : prod_visitor {
Expand Down Expand Up @@ -326,20 +326,16 @@ query_spec::query_spec(prod *p, struct scope *s, bool lateral) :

if (lateral)
scope->refs = s->refs;

limit = value_expr::factory(this, scope->schema->inttype, false);

from_clause = make_shared<struct from_clause>(this);
select_list = make_shared<struct select_list>(this);

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

search = bool_expr::factory(this);

if (d6() > 1) {
ostringstream cons;
auto expr = value_expr::factory(this, sqltype::get("int"), false);
cons << "limit coalesce(" << *expr << ", " << d100() + d100() << ")";
limit_clause = cons.str();
}
//limit = make_shared<column_reference>(this, scope->schema->inttype);
}

long prepare_stmt::seq;
Expand Down
3 changes: 2 additions & 1 deletion grammar.hh
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ struct query_spec : prod {
shared_ptr<struct from_clause> from_clause;
shared_ptr<struct select_list> select_list;
shared_ptr<bool_expr> search;
std::string limit_clause;
shared_ptr<value_expr> limit;
struct scope myscope;
virtual void out(std::ostream &out);
query_spec(prod *p, struct scope *s, bool lateral = 0);
virtual void accept(prod_visitor *v) {
v->visit(this);
limit->accept(v);
select_list->accept(v);
from_clause->accept(v);
search->accept(v);
Expand Down
2 changes: 1 addition & 1 deletion prod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void prod::retry()

impedance::limit(this);
throw std::runtime_error(std::string("excessive retries in ")
+ typeid(*this).name());
+ typeid(*this).name());
}

void prod::match()
Expand Down

0 comments on commit 55a1eba

Please sign in to comment.