Skip to content

Commit 6de07e5

Browse files
committed
Raneme InsertTableAlias to TableAliasWithoutColumns
1 parent 6444997 commit 6de07e5

5 files changed

Lines changed: 9 additions & 12 deletions

File tree

src/ast/dml.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ use crate::{
3030
};
3131

3232
use super::{
33-
display_comma_separated, helpers::attached_token::AttachedToken, query::InputFormatClause,
34-
Assignment, Expr, FromTable, Ident, InsertAliases, InsertTableAlias, MysqlInsertPriority,
35-
ObjectName, OnInsert, OptimizerHint, OrderByExpr, Query, SelectInto, SelectItem, Setting,
36-
SqliteOnConflict, TableFactor, TableObject, TableWithJoins, UpdateTableFromKind, Values,
33+
Assignment, Expr, FromTable, Ident, InsertAliases, TableAliasWithoutColumns, MysqlInsertPriority, ObjectName, OnInsert, OptimizerHint, OrderByExpr, Query, SelectInto, SelectItem, Setting, SqliteOnConflict, TableFactor, TableObject, TableWithJoins, UpdateTableFromKind, Values, display_comma_separated, helpers::attached_token::AttachedToken, query::InputFormatClause
3734
};
3835

3936
/// INSERT statement.
@@ -58,7 +55,7 @@ pub struct Insert {
5855
pub table: TableObject,
5956
/// `table_name as foo` (for PostgreSQL)
6057
/// `table_name foo` (for Oracle)
61-
pub table_alias: Option<InsertTableAlias>,
58+
pub table_alias: Option<TableAliasWithoutColumns>,
6259
/// COLUMNS
6360
pub columns: Vec<Ident>,
6461
/// Overwrite (Hive)

src/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6455,7 +6455,7 @@ pub struct InsertAliases {
64556455
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
64566456
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
64576457
/// Optional alias for an `INSERT` table; i.e. the table to be inserted into
6458-
pub struct InsertTableAlias {
6458+
pub struct TableAliasWithoutColumns {
64596459
/// `true` if the aliases was explicitly introduced with the "AS" keyword
64606460
pub explicit: bool,
64616461
/// the alias name itself

src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17138,15 +17138,15 @@ impl<'a> Parser<'a> {
1713817138
&& self.peek_one_of_keywords(&[Keyword::DEFAULT, Keyword::VALUES]).is_none()
1713917139
{
1714017140
self.maybe_parse(|parser| parser.parse_identifier())?
17141-
.map(|alias| InsertTableAlias {
17141+
.map(|alias| TableAliasWithoutColumns {
1714217142
explicit: false,
1714317143
alias,
1714417144
})
1714517145
} else {
1714617146
None
1714717147
}
1714817148
} else if dialect_of!(self is PostgreSqlDialect) && self.parse_keyword(Keyword::AS) {
17149-
Some(InsertTableAlias {
17149+
Some(TableAliasWithoutColumns {
1715017150
explicit: true,
1715117151
alias: self.parse_identifier()?,
1715217152
})

tests/sqlparser_oracle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use pretty_assertions::assert_eq;
2222

2323
use sqlparser::{
2424
ast::{
25-
BinaryOperator, Expr, Ident, Insert, InsertTableAlias, ObjectName, QuoteDelimitedString,
25+
BinaryOperator, Expr, Ident, Insert, TableAliasWithoutColumns, ObjectName, QuoteDelimitedString,
2626
Statement, TableObject, Value, ValueWithSpan,
2727
},
2828
dialect::OracleDialect,
@@ -426,7 +426,7 @@ fn test_insert_with_table_alias() {
426426
assert!(matches!(stmt,
427427
Statement::Insert(Insert {
428428
table: TableObject::TableName(table_name),
429-
table_alias: Some(InsertTableAlias {
429+
table_alias: Some(TableAliasWithoutColumns {
430430
explicit: false,
431431
alias: Ident {
432432
value: table_alias,

tests/sqlparser_postgres.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,7 +5406,7 @@ fn test_simple_postgres_insert_with_alias() {
54065406
quote_style: None,
54075407
span: Span::empty(),
54085408
}])),
5409-
table_alias: Some(InsertTableAlias {
5409+
table_alias: Some(TableAliasWithoutColumns {
54105410
explicit: true,
54115411
alias: Ident {
54125412
value: "test_table".to_string(),
@@ -5566,7 +5566,7 @@ fn test_simple_insert_with_quoted_alias() {
55665566
quote_style: None,
55675567
span: Span::empty(),
55685568
}])),
5569-
table_alias: Some(InsertTableAlias {
5569+
table_alias: Some(TableAliasWithoutColumns {
55705570
explicit: true,
55715571
alias: Ident {
55725572
value: "Test_Table".to_string(),

0 commit comments

Comments
 (0)