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

[CT-2502] [Bug] Wrap check constraint expression in parens #7480

Closed
Tracked by #7372
jtcohen6 opened this issue Apr 29, 2023 · 2 comments · Fixed by #7512
Closed
Tracked by #7372

[CT-2502] [Bug] Wrap check constraint expression in parens #7480

jtcohen6 opened this issue Apr 29, 2023 · 2 comments · Fixed by #7512
Assignees
Labels
bug Something isn't working Team:Adapters Issues designated for the adapter area of the code
Milestone

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Apr 29, 2023

duckdb/dbt-duckdb#156

if constraint.type == ConstraintType.check and constraint.expression:
return f"check {constraint.expression}"

if constraint.type == ConstraintType.check and constraint.expression:
return f"{constraint_prefix}check {constraint.expression}"

should both be

 if constraint.type == ConstraintType.check and constraint.expression: 
     return f"check ({constraint.expression})" 

Parentheses are required on:

  • Postgres
  • Databricks
  • DuckDB

Also:

  • Add functional tests on all our adapters for all supported constraints types
@github-actions github-actions bot changed the title [Bug] Wrap check constraint expression in parens [CT-2502] [Bug] Wrap check constraint expression in parens Apr 29, 2023
@jtcohen6 jtcohen6 added bug Something isn't working Team:Language Team:Adapters Issues designated for the adapter area of the code labels Apr 29, 2023
@jtcohen6 jtcohen6 added this to the v1.5.x milestone Apr 29, 2023
@jtcohen6 jtcohen6 assigned jtcohen6 and unassigned jtcohen6 May 3, 2023
@emmyoop
Copy link
Member

emmyoop commented May 3, 2023

Need to add tests in core/adapters for column level and model level constraints.

Open question: do methods needs to be updated?

@emmyoop
Copy link
Member

emmyoop commented May 3, 2023

Do along with #7417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team:Adapters Issues designated for the adapter area of the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants