Skip to content

Commit 7b809a3

Browse files
committed
Raneme InsertTableAlias to TableAliasWithoutColumns
1 parent 3f20ab1 commit 7b809a3

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

src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17234,15 +17234,15 @@ impl<'a> Parser<'a> {
1723417234
&& self.peek_one_of_keywords(&[Keyword::DEFAULT, Keyword::VALUES]).is_none()
1723517235
{
1723617236
self.maybe_parse(|parser| parser.parse_identifier())?
17237-
.map(|alias| InsertTableAlias {
17237+
.map(|alias| TableAliasWithoutColumns {
1723817238
explicit: false,
1723917239
alias,
1724017240
})
1724117241
} else {
1724217242
None
1724317243
}
1724417244
} else if dialect_of!(self is PostgreSqlDialect) && self.parse_keyword(Keyword::AS) {
17245-
Some(InsertTableAlias {
17245+
Some(TableAliasWithoutColumns {
1724617246
explicit: true,
1724717247
alias: self.parse_identifier()?,
1724817248
})

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,
@@ -433,7 +433,7 @@ fn test_insert_with_table_alias() {
433433
assert!(matches!(stmt,
434434
Statement::Insert(Insert {
435435
table: TableObject::TableName(table_name),
436-
table_alias: Some(InsertTableAlias {
436+
table_alias: Some(TableAliasWithoutColumns {
437437
explicit: false,
438438
alias: Ident {
439439
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)