Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-12815

cqlsh may throw AttributeError due to no table metadata

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 3.10
    • Component/s: Legacy/Tools
    • Labels:
      None
    • Severity:
      Normal
    • Since Version:

      Description

      Since CASSANDRA-11534 there is a potential bug in this code:

          if result.column_types:
                  ks_meta = self.conn.metadata.keyspaces[table_meta.keyspace_name]
                  cql_types = [CqlType(cql_typename(t), ks_meta) for t in result.column_types]
      

      It cannot be reproduced with any of our tests but there is a code path that could cause table_meta to be None when the statement cannot be parsed. Given that the code before 11534 used to check on table_meta not being None, I prefer to put back the same check in order to avoid any possible regressions once 3.10 is released. Also, since we check in all other places, this helps with consistency too.

      The only reason we need the table metadata in that code block is to get the keyspace name. We should fallback to the current keyspace name if we have no table metadata.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stefania Stefania Alborghetti
                Reporter:
                stefania Stefania Alborghetti
                Authors:
                Stefania Alborghetti
                Reviewers:
                Robert Stupp
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: