Skip to content

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

Merged
matthias-Q merged 2 commits into
DerekStride:mainfrom
matthias-Q:create_alter_drop_schema_truncate_explain
Jul 31, 2023
Merged

Add explain, truncate and alter/drop/create schema#187
matthias-Q merged 2 commits into
DerekStride:mainfrom
matthias-Q:create_alter_drop_schema_truncate_explain

Conversation

@matthias-Q

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

Copy link
Copy Markdown
Collaborator

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 DerekStride and dmfay July 30, 2023 07:33
Comment thread grammar.js Outdated
$.identifier,
),
),
repeat($._create_statement),

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread grammar.js Outdated
@matthias-Q
matthias-Q requested a review from dmfay July 30, 2023 19:40

@dmfay dmfay left a comment

Copy link
Copy Markdown
Collaborator

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