Skip to content

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.

4 participants