mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-11114 Cannot drop column referenced by CHECK constraint
SQL Standard behavior for DROP COLUMN xxx RESTRICT: * If a constraint (UNIQUE or CHECK) uses only the dropped column, it's automatically dropped too. If it uses many columns - an error.
This commit is contained in:
@ -345,28 +345,6 @@ db_datadict my_idx db_datadict t1_my_tablex f4 1
|
||||
db_datadict my_idx db_datadict t1_my_tablex first_col 2
|
||||
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1
|
||||
db_datadict PRIMARY db_datadict t1_my_tablex f2 2
|
||||
SELECT constraint_schema, constraint_name, table_schema,
|
||||
table_name, column_name, ordinal_position
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
ORDER BY constraint_schema, constraint_name, table_schema,
|
||||
table_name, ordinal_position;
|
||||
constraint_schema constraint_name table_schema table_name column_name ordinal_position
|
||||
db_datadict my_idx db_datadict t1_my_tablex f4 1
|
||||
db_datadict my_idx db_datadict t1_my_tablex first_col 2
|
||||
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1
|
||||
db_datadict PRIMARY db_datadict t1_my_tablex f2 2
|
||||
ALTER TABLE db_datadict.t1_my_tablex
|
||||
DROP COLUMN first_col;
|
||||
SELECT constraint_schema, constraint_name, table_schema,
|
||||
table_name, column_name, ordinal_position
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
ORDER BY constraint_schema, constraint_name, table_schema,
|
||||
table_name, ordinal_position;
|
||||
constraint_schema constraint_name table_schema table_name column_name ordinal_position
|
||||
db_datadict my_idx db_datadict t1_my_tablex f4 1
|
||||
db_datadict PRIMARY db_datadict t1_my_tablex f2 1
|
||||
SELECT table_name, column_name
|
||||
FROM information_schema.key_column_usage
|
||||
WHERE table_name = 't1_my_tablex'
|
||||
@ -374,6 +352,8 @@ ORDER BY table_name, column_name;
|
||||
table_name column_name
|
||||
t1_my_tablex f2
|
||||
t1_my_tablex f4
|
||||
t1_my_tablex first_col
|
||||
t1_my_tablex first_col
|
||||
DROP TABLE db_datadict.t1_my_tablex;
|
||||
SELECT table_name, column_name
|
||||
FROM information_schema.key_column_usage
|
||||
|
@ -162,7 +162,7 @@ SELECT table_name FROM information_schema.table_constraints
|
||||
WHERE table_name LIKE 't1_my_table%';
|
||||
table_name
|
||||
CREATE TABLE test.t1_my_table
|
||||
(f1 CHAR(12), f2 TIMESTAMP, f4 BIGINT, PRIMARY KEY(f1,f2))
|
||||
(f1 CHAR(12), f2 TIMESTAMP, f4 BIGINT, PRIMARY KEY(f1))
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
|
||||
ENGINE = <engine_type>;
|
||||
SELECT constraint_name, table_schema, table_name, constraint_type
|
||||
|
Reference in New Issue
Block a user