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

feat: add support to restart identity on truncate #42

Merged
merged 6 commits into from
Apr 28, 2021

Conversation

RafaelGSS
Copy link
Contributor

ref #41

Not sure about the implementation itself, I never played with Nearley before.

@RafaelGSS
Copy link
Contributor Author

Actually, It translates truncate table example restart identity to truncate table example that is not expected. Any thoughts?

type: 'truncate table',
tables: x[1],
}) %}
Copy link
Owner

@oguimbal oguimbal Apr 28, 2021

Choose a reason for hiding this comment

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

Technically, that parses, but the fact that restart identity is present should influence the generated AST.

In another hand, when it is NOT present, the generated AST should be the same as previously.

Moreover, if you implement restart identity, you should also implement continue identity ... see the spec.

Meaning something like:

delete_truncate ->  (kw_truncate %kw_table:?) array_of[table_ref] ((kw_restart | kw_continue) kw_identity):? {% x => track(x, {
                            type: 'truncate table',
                            tables: x[1],
                            ...x[2] && { identity: toStr(x[2][0]) },
                        })

and modify the corresponding AST typing definition:

export interface TruncateStatement {
     type: 'truncate table',
    //  [.....]
    identity?: 'restart' | 'continue';
}

@RafaelGSS RafaelGSS requested a review from oguimbal April 28, 2021 16:13
@oguimbal oguimbal merged commit 32a9dc7 into oguimbal:master Apr 28, 2021
@oguimbal
Copy link
Owner

Thanks :)

@oguimbal
Copy link
Owner

Released as [email protected] along with some non trivial breaking changes (sorry for that if it impacts you, I'll create a release notes)

@oguimbal
Copy link
Owner

see here

@RafaelGSS
Copy link
Contributor Author

@oguimbal any plans to use it in pg-mem?

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