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

Persist unique constraint setting in catalog #754

Merged
merged 4 commits into from
Jun 23, 2021
Merged

Conversation

chuan
Copy link
Contributor

@chuan chuan commented Jun 23, 2021

Added a new unique setting for the field table in catalog. Set the field as unique in catalog when creating tables or when creating an unique index on the field.


// Creating an unique index on a single field automatically makes the field
// unique. Do nothing for multiple-filed index creation because we do not
// support unique constraints for composite keys at the moment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should an error be given in the composite keys case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because we do support composite key indexes.

Comment on lines +46 to +52
ASSERT_TRUE(gaia_table_t::list()
.where(gaia_table_expr::name == "t")
.begin()
->gaia_fields()
.where(gaia_field_expr::name == "c")
.begin()
->unique());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting usage of the filter API!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

Copy link
Contributor

@simone-gaia simone-gaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chuan chuan merged commit c12329f into master Jun 23, 2021
@chuan chuan deleted the catalog-unique-constraint branch June 23, 2021 15:55
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.

4 participants