Skip to content

feat: Support TABLE keyword with SELECT INTO #487

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

Merged
merged 1 commit into from
May 9, 2022

Conversation

MazterQyou
Copy link
Contributor

This PR adds support for TABLE keyword with SELECT INTO queries which is valid as per PostgreSQL docs.
This allows processing queries like SELECT * INTO TEMPORARY TABLE "tmp" FROM (SELECT 1 AS COL) AS CHECKTEMP which otherwise would fail as TABLE would be parsed as a table name.

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.

Looks good -- thank you @MazterQyou

@@ -654,14 +654,16 @@ impl fmt::Display for Values {
pub struct SelectInto {
pub temporary: bool,
pub unlogged: bool,
pub table: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that this follows the rest of the crate's design to mirror the input syntax in the crated AST

👍

@alamb alamb merged commit 6b2fc81 into apache:main May 9, 2022
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2295027689

  • 4 of 5 (80.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.009%) to 90.435%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 1 2 50.0%
Totals Coverage Status
Change from base Build 2283154339: -0.009%
Covered Lines: 8178
Relevant Lines: 9043

💛 - Coveralls

@MazterQyou MazterQyou deleted the upstream-select-into-temporary-table branch May 9, 2022 19:07
MazterQyou added a commit to cube-js/sqlparser-rs that referenced this pull request May 9, 2022
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