Gabriel,
I agree. The way you've outlined it is more correct. I suspect ALTER
TABLE DROP COLUMN may suffer from a similar issue. Please file a JIRA
when you have a chance.
Thanks,
James

On Tue, Jan 13, 2015 at 12:14 PM, Gabriel Reid <[email protected]> wrote:
> 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