Skip to content

Commit

Permalink
Add limit with expressions (and null panic workaround)
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Dec 7, 2023
1 parent 968f758 commit 7377ce4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ grep -v "CAST does not support casting from" | # random nulls

# Functions returning sets:
grep -v "number of columns must be a positive integer literal" |
grep -v "regex_extract requires a string literal as its first argument" |
grep -v "regexp_extract requires a string literal as its first argument" |
grep -v -E "column \".*\" does not exist" | # https://github.com/MaterializeInc/materialize/issues/20533
grep -v -E "role \".*\" does not exist" |
grep -v "SET clause does not support casting from interval to integer" |
Expand Down
5 changes: 3 additions & 2 deletions grammar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,10 @@ query_spec::query_spec(prod *p, struct scope *s, bool lateral) :

search = bool_expr::factory(this);

if (d6() > 2) {
if (d6() > 1) {
ostringstream cons;
cons << "limit " << d100() + d100();
auto expr = value_expr::factory(this, sqltype::get("int"), false);
cons << "limit coalesce(" << *expr << ", " << d100() + d100() << ")";
limit_clause = cons.str();
}
}
Expand Down

0 comments on commit 7377ce4

Please sign in to comment.