Merge pull request #68 from ivanceras/master

Add LIMIT as RESERVED_FOR_TABLE_ALIAS
This commit is contained in:
Nikhil Benesch 2019-05-31 18:08:26 -04:00 committed by GitHub
commit 202464a06a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -124,6 +124,16 @@ fn parse_simple_select() {
assert_eq!(Some(ASTNode::SQLValue(Value::Long(5))), select.limit);
}
#[test]
fn parse_select_with_limit_but_no_where() {
let sql = "SELECT id, fname, lname FROM customer LIMIT 5";
let select = verified_only_select(sql);
assert_eq!(false, select.distinct);
assert_eq!(3, select.projection.len());
let select = verified_query(sql);
assert_eq!(Some(ASTNode::SQLValue(Value::Long(5))), select.limit);
}
#[test]
fn parse_select_distinct() {
let sql = "SELECT DISTINCT name FROM customer";