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

Parse check constraints #5760

Closed
kyleconroy opened this issue Jan 24, 2020 · 8 comments · Fixed by #6869
Closed

Parse check constraints #5760

kyleconroy opened this issue Jan 24, 2020 · 8 comments · Fixed by #6869
Labels
good first issue Good issue for new contributors Type: Enhancement Logical improvement (somewhere between a bug and feature)

Comments

@kyleconroy
Copy link

Feature Description

When creating a table in MySQL, a number of check constraints can be added.

CREATE TABLE t1
(
  CHECK (c1 <> c2),
  c1 INT CHECK (c1 > 10),
  c2 INT CONSTRAINT c2_positive CHECK (c2 > 0),
  c3 INT CHECK (c3 < 100),
  CONSTRAINT c1_nonzero CHECK (c1 <> 0),
  CHECK (c1 > c3)
);

The sqlparser module does not currently parse these statements.

Use Case(s)

sqlparser is being used by https://github.com/kyleconroy/sqlc, a SQL to Go code generator, and needs this information to correctly generate code from database migrations and other code using CHECK constraints.

@morgo morgo added Type: Enhancement Logical improvement (somewhere between a bug and feature) good first issue Good issue for new contributors labels Jan 24, 2020
@yindia
Copy link
Contributor

yindia commented Feb 24, 2020

@morgo Would like to work on this but I need a help.

@morgo
Copy link
Contributor

morgo commented Feb 24, 2020

@systay and @harshit-gangal are the best mentors. They are Andres Taylor and Harshit on Slack.

@supra08
Copy link

supra08 commented Mar 3, 2020

Hi @evalsocket ! Are you working on this? If not, I would like to take this up.
@morgo ?

@morgo
Copy link
Contributor

morgo commented Mar 3, 2020

@supra08 There are no open PRs that correspond to this. Let's give @evalsocket a brief moment to reply, but I think it's yours for the taking :-)

@supra08
Copy link

supra08 commented Mar 3, 2020

Alright thanks!

@ilknarf
Copy link
Contributor

ilknarf commented Sep 25, 2020

@supra08 have you been working on this? If not, I would love to take a crack.

@supra08
Copy link

supra08 commented Sep 25, 2020

No sorry, I haven't been working on it. You can take it up.

@ilknarf
Copy link
Contributor

ilknarf commented Sep 25, 2020

No sorry, I haven't been working on it. You can take it up.

Thanks for the prompt reply, I'll take a shot at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for new contributors Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants