Details
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
- is caused by
-
PHOENIX-2901 If namespaces are enabled, check for existence of schema when sequence created
-
- Closed
-
- links to