[MDEV-28401] incorrect behavior of ALTER ... COLUMN IF [NOT] EXISTS Created: 2022-04-23  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Sergei Golubchik Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

create table t (c date);
alter table t change column if exists n c int unique;

this should fail, because the column n does not exist. But it partially succeeds, the result is c date unique.

Another example, for ADD IF NOT EXISTS:

create table t (c date);
alter table t add column if not exists c int unique;

Same effect.



 Comments   
Comment by Elena Stepanova [ 2022-04-23 ]

Probably not fail but end with a warning, otherwise what's the point in if exists at all?

What about

create table t (c date);
alter table t change column if exists n c int, add unique (c);

will it also stop after unsuccessful first part?

Comment by Sergei Golubchik [ 2022-04-24 ]

Yes, of course. Sorry. By "fail" I meant that no changes should've been done.

If you have two operations in ALTER TABLE, than the second should succeed.

Generated at Thu Feb 08 10:00:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.