Parse a table reference in a FROM clause
(expr: TableFactor)
| 78 | |
| 79 | /// Parse a table reference in a FROM clause |
| 80 | fn parse_relvar(expr: TableFactor) -> SqlParseResult<(SqlIdent, SqlIdent)> { |
| 81 | match expr { |
| 82 | // Relvar no alias |
| 83 | TableFactor::Table { |
| 84 | name, |
| 85 | alias: None, |
| 86 | args: None, |
| 87 | with_hints, |
| 88 | version: None, |
| 89 | partitions, |
| 90 | } if with_hints.is_empty() && partitions.is_empty() => { |
| 91 | let name = parse_ident(name)?; |
| 92 | let alias = name.clone(); |
| 93 | Ok((name, alias)) |
| 94 | } |
| 95 | // Relvar with alias |
| 96 | TableFactor::Table { |
| 97 | name, |
| 98 | alias: Some(TableAlias { name: alias, columns }), |
| 99 | args: None, |
| 100 | with_hints, |
| 101 | version: None, |
| 102 | partitions, |
| 103 | } if with_hints.is_empty() && partitions.is_empty() && columns.is_empty() => { |
| 104 | Ok((parse_ident(name)?, alias.into())) |
| 105 | } |
| 106 | _ => Err(SqlUnsupported::From(expr).into()), |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | /// Parse the items of a SELECT clause |