mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-11 14:32:04 +00:00
Support views with explicit column names
A `CREATE VIEW` statement may provide names for its columns that override the names of the columns derived from the view's query.
This commit is contained in:
parent
2f4cd8f6c8
commit
73ed685879
3 changed files with 37 additions and 3 deletions
|
@ -775,7 +775,7 @@ impl Parser {
|
|||
// Many dialects support `OR REPLACE` | `OR ALTER` right after `CREATE`, but we don't (yet).
|
||||
// ANSI SQL and Postgres support RECURSIVE here, but we don't support it either.
|
||||
let name = self.parse_object_name()?;
|
||||
// Parenthesized "output" columns list could be handled here.
|
||||
let columns = self.parse_parenthesized_column_list(Optional)?;
|
||||
let with_options = if self.parse_keyword("WITH") {
|
||||
self.parse_with_options()?
|
||||
} else {
|
||||
|
@ -786,6 +786,7 @@ impl Parser {
|
|||
// Optional `WITH [ CASCADED | LOCAL ] CHECK OPTION` is widely supported here.
|
||||
Ok(SQLStatement::SQLCreateView {
|
||||
name,
|
||||
columns,
|
||||
query,
|
||||
materialized,
|
||||
with_options,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue