diff --git a/CHANGES.txt b/CHANGES.txt index 81785554eb..6f1c4a3268 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,6 +16,7 @@ Merged from 3.0: * Fix filtering on non-primary key columns for queries without index (CASSANDRA-6377) * Fix sstableloader fail when using materialized view (CASSANDRA-11275) Merged from 2.2: + * (cqlsh) Fix error when result is 0 rows with EXPAND ON (CASSANDRA-11092) * Add missing newline at end of bin/cqlsh (CASSANDRA-11325) * Unresolved hostname leads to replace being ignored (CASSANDRA-11210) * Only log yaml config once, at startup (CASSANDRA-11217) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index f8cd32d56e..3be72b41a7 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -1328,7 +1328,13 @@ class Shell(cmd.Cmd): def print_static_result(self, column_names, rows, table_meta): if not column_names and not table_meta: return + column_names = column_names or table_meta.columns.keys() + formatted_names = [self.myformat_colname(name, table_meta) for name in column_names] + if not rows: + # print header only + self.print_formatted_result(formatted_names, None) + return cql_types = [] if table_meta: @@ -1336,7 +1342,6 @@ class Shell(cmd.Cmd): cql_types = [CqlType(table_meta.columns[c].cql_type, ks_meta) if c in table_meta.columns else None for c in column_names] - formatted_names = [self.myformat_colname(name, table_meta) for name in column_names] formatted_values = [map(self.myformat_value, row.values(), cql_types) for row in rows] if self.expand_enabled: