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

Better display table organization on desc table via primary key list

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.0.9
    • None
    • None

    Description

      In cqlsh, the desc table command does not make it sufficiently clear which columns are part of the row key and which are clustering keys.

      A simple change to the primary key list, though, would make it easier to tell.

      Consider the following table definition:

      create table my_table {
        first_column text,
        second_column text,
        third_column text,
        primary key (first_column, second_column, third_column)
      }
      

      This table has a row key of first_column and clustering keys of second_column, third_column. But if the user intended for the table to have all three in the row key, the correct definition would be:

      create table my_table {
        first_column text,
        second_column text,
        third_column text,
        primary key ((first_column, second_column, third_column))
      }
      

      But this is a sufficiently subtle difference that the first may be mistaken for the second or vice-versa.

      My suggested solution is to always wrap the row key in parentheses. This is already supported by create table syntax, so it's just a matter of changing desc table to display the create table statement with the primary key always in parentheses, like so:

      create table my_table {
        first_column text,
        second_column text,
        third_column text,
        primary key ((first_column), second_column, third_column)
      }
      

      Attachments

        1. 7274-2.txt
          0.7 kB
          Patrick McFadin
        2. 7274.txt
          0.5 kB
          Patrick McFadin

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            pmcfadin Patrick McFadin Assign to me
            gworley3 G Gordon Worley III
            Patrick McFadin
            Aleksey Yeschenko
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment