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

Add support for IF EXISTS and IF NOT EXISTS in ALTER statements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.1-alpha1, 4.1
    • CQL/Syntax
    • None

    Description

      It would make sense to add support for IF EXISTS and IF NOT EXISTS in the different ALTER statements.

      For example:

      • ALTER TABLE IF EXISTS myTable ...
      • ALTER TABLE myTable ADD IF NOT EXISTS ...
      • ALTER TABLE myTable DROP IF EXISTS ...
      • ALTER TYPE IF EXISTS myType ...
      • ALTER TYPE myType ADD IF NOT EXISTS ...

      Additional info for newcomers:

      In order to implement this change you will need to change the Parser.g ANTLR file located in the src/antlr directory and the java classes corresponding to the different alter statements located in the org.apache.cassandra.cql3.statements.schema package. You can look at the CreateTableStatement class to see how it was done there.
      The unit test for the CQL logic are located under org.apache.cassandra.cql3.validation

      Attachments

        Issue Links

          Activity

            People

              djanand Jogesh Anand
              blerer Benjamin Lerer
              Jogesh Anand
              Benjamin Lerer, Berenguer Blasi
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m