-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[YSQL] Support ALTER TABLE ADD PRIMARY KEY for colocated tables #7534
Comments
See also: #6159 |
myang2021
added a commit
that referenced
this issue
Apr 22, 2021
Summary: Currently for a table in a colocated database or in a tablegroup, altering table to add primary key fails with the following error, CREATE DATABASE clc WITH colocated = true; CREATE DATABASE You are now connected to database "clc" as user "yugabyte". CREATE TABLE nopk_c (id int); CREATE TABLE INSERT INTO nopk_c VALUES (3); INSERT 0 1 INSERT INTO nopk_c VALUES (4); INSERT 0 1 clc=# ALTER TABLE nopk_c ADD PRIMARY KEY (id); ALTER TABLE nopk_c ADD PRIMARY KEY (id); ERROR: adding primary key to a colocated table is not yet implemented Since we now support add primary key, we can remove this error. The existing tests already have some test code paths for the cases once the above error is removed and they are now enabled. Also fixed a potential null pointer SEGV in get_tablegroup_name when the tuple is not found. Test Plan: ybd debug --verbose --java-test org.yb.pgsql.TestPgAlterTableAddPrimaryKey ybd debug --verbose --java-test org.yb.pgsql.TestPgRegressTablegroup Reviewers: mihnea, dsrinivasan, alex Reviewed By: alex Differential Revision: https://phabricator.dev.yugabyte.com/D11069
Fixed by b318938. |
YintongMa
pushed a commit
to YintongMa/yugabyte-db
that referenced
this issue
May 26, 2021
…ed tables Summary: Currently for a table in a colocated database or in a tablegroup, altering table to add primary key fails with the following error, CREATE DATABASE clc WITH colocated = true; CREATE DATABASE You are now connected to database "clc" as user "yugabyte". CREATE TABLE nopk_c (id int); CREATE TABLE INSERT INTO nopk_c VALUES (3); INSERT 0 1 INSERT INTO nopk_c VALUES (4); INSERT 0 1 clc=# ALTER TABLE nopk_c ADD PRIMARY KEY (id); ALTER TABLE nopk_c ADD PRIMARY KEY (id); ERROR: adding primary key to a colocated table is not yet implemented Since we now support add primary key, we can remove this error. The existing tests already have some test code paths for the cases once the above error is removed and they are now enabled. Also fixed a potential null pointer SEGV in get_tablegroup_name when the tuple is not found. Test Plan: ybd debug --verbose --java-test org.yb.pgsql.TestPgAlterTableAddPrimaryKey ybd debug --verbose --java-test org.yb.pgsql.TestPgRegressTablegroup Reviewers: mihnea, dsrinivasan, alex Reviewed By: alex Differential Revision: https://phabricator.dev.yugabyte.com/D11069
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i.e. for tables in colocated databases or in a tablegroup.
Should be analogous to the regular table case.
See also: https://docs.yugabyte.com/latest/explore/colocated-tables.
One note about the regress tests needed:
cc @frozenspider
The text was updated successfully, but these errors were encountered: