Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support row_alias and col_aliases in INSERT statement for mysql and generic dialects #1136

Merged
merged 6 commits into from
Mar 8, 2024

Conversation

emin100
Copy link
Contributor

@emin100 emin100 commented Feb 16, 2024

Example: INSERT INTO table (date) VALUES (2024-01-01) AS alias (mek)

    Example: INSERT INTO `table` (`date`) VALUES (2024-01-01) AS `alias` (`mek`)
@coveralls
Copy link

coveralls commented Feb 16, 2024

Pull Request Test Coverage Report for Build 8139962636

Details

  • 79 of 80 (98.75%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 87.864%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 8 9 88.89%
Files with Coverage Reduction New Missed Lines %
src/ast/mod.rs 1 79.97%
Totals Coverage Status
Change from base Build 8128645646: 0.04%
Covered Lines: 20489
Relevant Lines: 23319

💛 - Coveralls

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @emin100 . I left some comments. Let me know what you think

src/ast/mod.rs Outdated Show resolved Hide resolved
src/ast/mod.rs Show resolved Hide resolved
tests/sqlparser_mysql.rs Outdated Show resolved Hide resolved
@alamb
Copy link
Contributor

alamb commented Feb 28, 2024

I apologize for the delay in reviewing

@alamb
Copy link
Contributor

alamb commented Feb 29, 2024

Marking as Draft to signify this PR is no longer waiting on review. Please mark it as ready for review when it is ready for another look.

@alamb alamb marked this pull request as draft February 29, 2024 14:14
@emin100 emin100 marked this pull request as ready for review March 1, 2024 19:29
@emin100
Copy link
Contributor Author

emin100 commented Mar 1, 2024

@alamb Thanks for comments.

@alamb alamb changed the title Support as part in insert statement for mysql and generic dialects Support row_alias and col_aliases in INSERT statement for mysql and generic dialects Mar 1, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @emin100 -- I think this is really close. There is just some strangeness with the row_name not being an Option which I think we should sort out

src/ast/mod.rs Outdated Show resolved Hide resolved
tests/sqlparser_mysql.rs Show resolved Hide resolved
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @emin100 -- sorry it took a few back and forths but I think this PR looks really nice now. Thanks again

@@ -4194,6 +4207,14 @@ pub enum OnInsert {
OnConflict(OnConflict),
}

#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@alamb alamb merged commit 11899fd into apache:main Mar 8, 2024
10 checks passed
@emin100 emin100 deleted the insert_as branch March 9, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants