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

Generated column spec is wrong #198

Open
antoineB opened this issue Sep 29, 2023 · 2 comments
Open

Generated column spec is wrong #198

antoineB opened this issue Sep 29, 2023 · 2 comments

Comments

@antoineB
Copy link
Contributor

According to postgres doc https://www.postgresql.org/docs/current/sql-createtable.html
The spec of GENERATED should not be:

      seq(
        optional(seq($.keyword_generated, $.keyword_always)),
        $.keyword_as,
        $._expression,
      ),

But

      seq(
        $.keyword_generated,
        choice(
          seq($.keyword_always, $.keyword_as, $.paren_list($._expression), $.keyword_stored),
          seq(
            choice(
              $.keyword_always,
              seq($.keyword_by, $.keyword_default)
            ),
            $.keyword_as,
            $.keyword_identity,
            optional($.paren_list($.sequence_options))
          ),
        ),
      ),
@matthias-Q
Copy link
Collaborator

matthias-Q commented Oct 2, 2023

I have not taken a very deep look into this for a long time, but keep in mind that this parser is aimed to be permissive. It should also support other dialects like MySQL, MariaDB and so on.

Do you get an error with a SQL statement while parsing?

@matthias-Q
Copy link
Collaborator

But you are right. I just tested some of the first examples of the Postgres documentation for create table and I get some parsing errors.

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

No branches or pull requests

2 participants