I've encountered what appears (to me) to be buggy behavior when using
the ALTER TABLE ADD IF NOT EXISTS functionality to conditionally add
columns, and just wanted to check off that it is (or isn't) actually a
bug.

If I have a table and execute an "ALTER TABLE ADD IF NOT EXISTS
thisColAlreadyExists varchar, thisColDoesNotExist varchar", then
nothing will be changed in the table because thisColAlreadyExists
already exists.

If I omit the already-existing column from the statement, all columns
do get created.

My expectation would be that when you use ADD IF NOT EXISTS, all
non-existent columns will be added, and all existing columns in the
statement will just be ignored. I've noticed that there is a test
(AlterTableIT#testAddVarCols) that actually demonstrates the current
behavior, which makes me think that it must be intentional and not a
bug -- however, I'd just like to check. Can anyone enlighten me?

Thanks,

Gabriel

Reply via email to