-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support ALTER TABLE ADD PRIMARY KEY
statements
#11895
base: feature
Are you sure you want to change the base?
Conversation
I'm not sure this is the best time to add this feature, as there is a pending PR to rework binding of Indexes (#11867) |
Thanks for the quick review! Regarding #11867, I guess that would affect the part about indexes, which should affect only small part of the code from this PR (the |
I fixed all comments, let me know if there is anything else I can change! |
f14b1f4
to
e05ed09
Compare
e05ed09
to
e7d1570
Compare
e7d1570
to
ce62349
Compare
ce62349
to
70b552a
Compare
Thank you for the changes! |
b7d693b
to
1d11f30
Compare
…se it. Taking advantage of polymorphism to replace switch statements in a couple places. I also had to refactor UniqueBoundConstraint to use PhysicalIndexes instead of LogicalIndexes, in a similar way to all other BoundConstraints.
…er for ALTER TABLE statements
I renamed it AddConstraintIndex. By the name, this method belongs there, and I need it later in the DataTable class constructor to handle addition of unique indices.
Now, when a new unique index is created and a modified instance of the storage is made, the DataTable will automatically add an ART index and index existing rows, throwing an error if the uniqueness is not satisfied.
This makes code that needs to access the index after the addition to the table simpler.
This is not necessary because creating a unique index automatically checks the uniqueness.
851a466
to
ca4137e
Compare
This PR implements
ALTER TABLE table ADD PRIMARY KEY (col1, ...);
statements, as per #57.I suggest reviewing by commit, as I tried to make them thematic and self-contained. However, the first commits basically do changes needed for the last 2-3 commits, so please have a look at the final ones if something's unclear.
Let me know if there is anything I can improve.