Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-6574

Executing "DROP TABLE" drops all sequences

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 4.16.1, 4.17.0, 5.2.0, 5.1.2
    • 4.17.0, 5.2.0, 4.16.2, 5.1.3
    • core
    • None

    Description

      It is a very strange behavior (to my understanding). If I create a table and delete it immediately afterwards, it deletes the sequences from the catalog. Moreover, depending on whether I have used them or not, itdisappears completely or not..

      In the following sequence of instructions you see what I mean (My starting point is an empty bbdd):

      -first case (not using the sequence):

      SELECT * FROM SYSTEM."SEQUENCE";

      // empty data

       

      CREATE SEQUENCE SEQUENCENAME;
      SELECT * FROM SYSTEM."SEQUENCE";

      // there is the secuence

      CREATE TABLE DUMMYTABLE (FIELD1 BIGINT, FIELD2 VARCHAR(255), ID BIGINT NOT NULL, CONSTRAINT PK PRIMARY KEY (ID));

      //we create a table

       

      SELECT * FROM SYSTEM."SEQUENCE";

      //The sequence is still there

       

      DROP TABLE IF EXISTS DUMMYTABLE;

      //delete the table

       

      SELECT * FROM SYSTEM."SEQUENCE";
      // hey!! the sequence has disappeared !!! why?!?

      SELECT NEXT VALUE FOR SEQUENCENAME;

      //It throws an exception because the squence does not exists

       

      -secondcase (using the sequence):

      SELECT * FROM SYSTEM."SEQUENCE";

      CREATE SEQUENCE SEQUENCENAME2;
      SELECT * FROM SYSTEM."SEQUENCE";

      SELECT NEXT VALUE FOR SEQUENCENAME2;

      // this is the little diference: we are using the secuence
      SELECT * FROM SYSTEM."SEQUENCE";

      CREATE TABLE DUMMYTABLE (FIELD1 BIGINT, FIELD2 VARCHAR(255), ID BIGINT NOT NULL, CONSTRAINT PK PRIMARY KEY (ID));
      SELECT * FROM SYSTEM."SEQUENCE";

      DROP TABLE IF EXISTS DUMMYTABLE;
      SELECT * FROM SYSTEM."SEQUENCE";
      //The sequence also disapears. It should not be usable.
      SELECT NEXT VALUE FOR SEQUENCENAME2;

      //it does NOT throws an exception even it does not exists
      SELECT * FROM SYSTEM."SEQUENCE";

       

      Maybe there is something that I am missing, but I think that this is critical a bug.

      Attachments

        Issue Links

          Activity

            People

              stoty Istvan Toth
              alejandro_anadon@hotmail.com Alejandro Anadon
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: