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

Convert SQL CREATE TABLE inline CHECK constraints #552

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

andrew-farries
Copy link
Collaborator

@andrew-farries andrew-farries commented Dec 19, 2024

Convert SQL CREATE TABLE statements with inline CHECK constraints like this:

CREATE TABLE foo(a int CHECK (a > 0))

to OpCreateTable operations like this:

[
  {
    "create_table": {
      "columns": [
        {
          "check": {
            "constraint": "a > 0",
            "name": "foo_a_check"
          },
          "name": "a",
          "nullable": true,
          "type": "int"
        }
      ],
      "name": "foo"
    }
  }
]

@andrew-farries andrew-farries changed the title Convert SQL CREATE TABLE inlineCHECK constraints Convert SQL CREATE TABLE inline CHECK constraints Dec 19, 2024
@andrew-farries andrew-farries marked this pull request as ready for review December 19, 2024 09:54
Base automatically changed from unconvertible-table-constraints to main December 19, 2024 12:54
Convert SQL `CREATE TABLE` statements with inline `CHECK` constraints
like this:

```
CREATE TABLE foo(a int CHECK (a > 0))
```

to `OpCreateTable` operations.
When converting inline `CHECK` constraints in `CREATE TABLE` statements,
ensure that the constraint is named according to Postgres naming
conventions for inline `CHECK` constraints.
@andrew-farries andrew-farries force-pushed the convert-create-table-inline-check-constraints branch from 5f92000 to 5202eb9 Compare December 19, 2024 12:57
@andrew-farries andrew-farries merged commit 5450d7a into main Dec 19, 2024
28 checks passed
@andrew-farries andrew-farries deleted the convert-create-table-inline-check-constraints branch December 19, 2024 13:10
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