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

DB-12363: fix drop column and constraints #5703

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

DB-12363: fix drop column and constraints #5703

wants to merge 1 commit into from

Conversation

jyuanca
Copy link

@jyuanca jyuanca commented Jul 20, 2021

Short Description

Fix a regression from DB-12306.

Long Description

If a constraint is defined on a column, the constraint should be dropped when the column is being dropped. The column reference stored in constraint is storage position, so we should get storage position of the dropped column to check whether a constraint is defined on the column.

DB-12306 tried to fix a similar issue for triggers, which store relative column position. We need to check triggers using relative position, and check constraints using storage position

How to test

CREATE TABLE PLAIN_ALTER_SQL.float_alter2 ( VAL1 FLOAT);
ALTER TABLE PLAIN_ALTER_SQL.float_alter2 ADD COLUMN VAL5 FLOAT;
ALTER TABLE PLAIN_ALTER_SQL.float_alter2 DROP COLUMN VAL5;

ALTER TABLE PLAIN_ALTER_SQL.float_alter2 ADD COLUMN VAL6 FLOAT NOT NULL DEFAULT 111 CONSTRAINT float_VAL6 PRIMARY KEY;
ALTER TABLE PLAIN_ALTER_SQL.float_alter2 DROP VAL6; -- this should drop the PK constraint

SELECT * FROM SYS.SYSCONSTRAINTS;

@jyuanca
Copy link
Author

jyuanca commented Jul 20, 2021

jenkins please test branch @cdh6.3.0

@cloudspliceci
Copy link
Contributor

@jyuanca
Copy link
Author

jyuanca commented Jul 21, 2021

jenkins please test branch @cdh6.3.0

@cloudspliceci
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants