Skip to content

Commit b35094a

Browse files
committed
Raneme InsertTableAlias to TableAliasWithoutColumns
1 parent e9b8fb6 commit b35094a

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
@@ -6460,7 +6460,7 @@ pub struct InsertAliases {
64606460
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
64616461
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
64626462
/// Optional alias for an `INSERT` table; i.e. the table to be inserted into
6463-
pub struct InsertTableAlias {
6463+
pub struct TableAliasWithoutColumns {
64646464
/// `true` if the aliases was explicitly introduced with the "AS" keyword
64656465
pub explicit: bool,
64666466
/// the alias name itself

src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17171,15 +17171,15 @@ impl<'a> Parser<'a> {
1717117171
&& self.peek_one_of_keywords(&[Keyword::DEFAULT, Keyword::VALUES]).is_none()
1717217172
{
1717317173
self.maybe_parse(|parser| parser.parse_identifier())?
17174-
.map(|alias| InsertTableAlias {
17174+
.map(|alias| TableAliasWithoutColumns {
1717517175
explicit: false,
1717617176
alias,
1717717177
})
1717817178
} else {
1717917179
None
1718017180
}
1718117181
} else if dialect_of!(self is PostgreSqlDialect) && self.parse_keyword(Keyword::AS) {
17182-
Some(InsertTableAlias {
17182+
Some(TableAliasWithoutColumns {
1718317183
explicit: true,
1718417184
alias: self.parse_identifier()?,
1718517185
})

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
@@ -5445,7 +5445,7 @@ fn test_simple_postgres_insert_with_alias() {
54455445
quote_style: None,
54465446
span: Span::empty(),
54475447
}])),
5448-
table_alias: Some(InsertTableAlias {
5448+
table_alias: Some(TableAliasWithoutColumns {
54495449
explicit: true,
54505450
alias: Ident {
54515451
value: "test_table".to_string(),
@@ -5605,7 +5605,7 @@ fn test_simple_insert_with_quoted_alias() {
56055605
quote_style: None,
56065606
span: Span::empty(),
56075607
}])),
5608-
table_alias: Some(InsertTableAlias {
5608+
table_alias: Some(TableAliasWithoutColumns {
56095609
explicit: true,
56105610
alias: Ident {
56115611
value: "Test_Table".to_string(),

0 commit comments

Comments
 (0)