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

Add explain, truncate and alter/drop/create schema #187

Conversation

matthias-Q
Copy link
Collaborator

@matthias-Q matthias-Q commented Jul 30, 2023

This PR adds multiple missing statements

  • for schemas
  • truncate
  • explain

I have left out the optional options for explain. They add multiple pg specific keywords. Not sure how we want to handle this. Also, statements that can be analyzed are a mixture of some of the _dml_read, _dml_write and _ddl_statement. It is more permissive now, but it also required this precedence. Unfortunately, this significantly increases compilation time and parser size again.

CREATE SCHEMA allows to be followed by other CREATE statements. Again, it is now permissive and requires a precedence.

@matthias-Q matthias-Q requested review from dmfay and DerekStride July 30, 2023 07:33
grammar.js Outdated
$.identifier,
),
),
repeat($._create_statement),
Copy link
Collaborator

Choose a reason for hiding this comment

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

structuring this form into program (now a choice) and deleting the repeat line seems to work well. It does require precedence over _create_statement -> create_schema but I think that's reasonable

      prec(2, seq(
        $.create_schema,
        repeat($._create_statement),
      )),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure that I understand this correctly. Isn't the program node a bit too close to the root of the tree?

I have put it in the create_statement with a left prec.

grammar.js Outdated Show resolved Hide resolved
@matthias-Q matthias-Q requested a review from dmfay July 30, 2023 19:40
Copy link
Collaborator

@dmfay dmfay left a comment

Choose a reason for hiding this comment

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

Not sure that I understand this correctly. Isn't the program node a bit too close to the root of the tree?

I have put it in the create_statement with a left prec.

oh that's a good place for it!

@matthias-Q matthias-Q merged commit 5c92e8a into DerekStride:main Jul 31, 2023
@matthias-Q matthias-Q deleted the create_alter_drop_schema_truncate_explain branch July 31, 2023 05:45
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.

2 participants