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

ISSUE-1147: Add support for MATERIALIZED CTEs #1148

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

ReppCodes
Copy link
Contributor

In Postgres, the [NOT] MATERIALIZED keywords can be applied when creating CTEs. Add support for them.

In Postgres, the [NOT] MATERIALIZED keywords can be applied when
creating CTEs. Add support for them.
@coveralls
Copy link

coveralls commented Feb 28, 2024

Pull Request Test Coverage Report for Build 8095954676

Details

  • 23 of 27 (85.19%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.004%) to 87.712%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/query.rs 8 10 80.0%
src/parser/mod.rs 10 12 83.33%
Totals Coverage Status
Change from base Build 8095830473: -0.004%
Covered Lines: 19787
Relevant Lines: 22559

💛 - Coveralls

src/ast/query.rs Outdated
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
pub enum CteAsMaterialized {
/// The WITH statement does not specify MATERIALIZED behavior
Default,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Most other places in sqlparser-rs use Option<..> to represent the case when a clause is not present.

Since I had this branch checked out locally to resolve a merge conflict, I went ahead and made that change as well in 6df536a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah for sure!

This route means we should remove the Default enum member though because now it's not useful, and if it does get added at some point it'll print with extra whitespace.

Mind if I add a commit to the PR doing so?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure -- go ahead. I think I did remove CteAsMaterialized::Default in 6df536a though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah nevermind, so you did. I misread it. Thanks!

Copy link
Collaborator

@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 @ReppCodes -- looks good to me

@alamb alamb merged commit 0c5f6fb into sqlparser-rs:main Feb 29, 2024
10 checks passed
@ReppCodes ReppCodes deleted the postgres_mat_cte branch February 29, 2024 13:02
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.

None yet

3 participants