diff --git a/bin/cqlsh b/bin/cqlsh index f4773a71a7..5ea3bd520e 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -1901,12 +1901,12 @@ class Shell(cmd.Cmd): ALTER COLUMNFAMILY addamsFamily ALTER lastKnownLocation TYPE uuid; ALTER COLUMNFAMILY ... ALTER changes the expected storage type for a - column. The column must already have a type in the column family - metadata. The column may or may not already exist in current rows-- but - be aware that no validation of existing data is done. The bytes stored - in values for that column will remain unchanged, and if existing data - is not deserializable according to the new type, this may cause your - CQL driver or interface to report errors. + column. The column must either be the key alias or already have a type + in the column family metadata. The column may or may not already exist + in current rows-- but be aware that no validation of existing data is + done. The bytes stored in values for that column will remain unchanged, + and if existing data is not deserializable according to the new type, + this may cause your CQL driver or interface to report errors. """ def help_alter_add(self): diff --git a/doc/cql/CQL.textile b/doc/cql/CQL.textile index 4fd3d74029..1cfe8834f9 100644 --- a/doc/cql/CQL.textile +++ b/doc/cql/CQL.textile @@ -634,7 +634,7 @@ h3. Changing the type of a typed column bc(sample). ALTER COLUMNFAMILY addamsFamily ALTER lastKnownLocation TYPE uuid; -@ALTER COLUMNFAMILY ... ALTER@ changes the expected storage type for a column. The column must already have a type in the column family metadata. The column may or may not already exist in current rows-- but be aware that no validation of existing data is done. The bytes stored in values for that column will remain unchanged, and if existing data is not deserializable according to the new type, this may cause your CQL driver or interface to report errors. +@ALTER COLUMNFAMILY ... ALTER@ changes the expected storage type for a column. The column must either be the key alias or already have a type in the column family metadata. The column may or may not already exist in current rows-- but be aware that no validation of existing data is done. The bytes stored in values for that column will remain unchanged, and if existing data is not deserializable according to the new type, this may cause your CQL driver or interface to report errors. h3. Adding a typed column diff --git a/pylib/cqlshlib/cqlhandling.py b/pylib/cqlshlib/cqlhandling.py index e45fb45375..d494a91164 100644 --- a/pylib/cqlshlib/cqlhandling.py +++ b/pylib/cqlshlib/cqlhandling.py @@ -726,7 +726,10 @@ def alter_table_cf_completer(ctxt, cass): @completer_for('alterInstructions', 'existcol') def alter_table_col_completer(ctxt, cass): cfdef = cass.get_columnfamily(cql_dequote(ctxt.get_binding('cf'))) - return map(maybe_cql_escape, [md.name for md in cfdef.column_metadata]) + cols = [md.name for md in cfdef.column_metadata] + if cfdef.key_alias is not None: + cols.append(cfdef.key_alias) + return map(maybe_cql_escape, cols) explain_completion('alterInstructions', 'newcol', '')