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

fix(postgres): Fix UNIQUE consuming tokens #3775

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

VaggelisD
Copy link
Collaborator

@VaggelisD VaggelisD commented Jul 16, 2024

Fixes #3774

Currently _parse_unique() attempts to parse MySQL's UNIQUE constraint (#1708), which is parsed as:

UNIQUE KEY [<key>] (<col> [,...])

However, Postgres's UNIQUE (syntax below) does not seem to define <key> so it must not preemptively consume an id_var for it:

UNIQUE [NULLS NOT DISTINCT] [(<col> [, ...])]

For this reason, this PR:

  • Turns off the [<key>] parsing in Postgres
  • Adds support for NOT NULLS DISTINCT as a low-lift addition to increase DDL coverage

Docs

Postgres UNIQUE | Postgres DEFAULT | MySQL UNIQUE

@VaggelisD VaggelisD requested a review from tobymao July 16, 2024 16:24
@VaggelisD VaggelisD merged commit 19370d5 into main Jul 18, 2024
6 checks passed
@VaggelisD VaggelisD deleted the vaggelisd/postgres_default branch July 18, 2024 08:41
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.

Issue parsing gen_random_uuid() in postgres script.
2 participants