Thread: Bug #581: Sequence cannot be deleted
BAZIN Nicolas (nbazin@ingenico.com.au) reports a bug with a severity of 1 The lower the number the more severe it is. Short Description Sequence cannot be deleted Long Description A Sequence is created automatically with the SQL command: CREATE TABLE fa_ccpsholderscpt(hsc_serial SERIAL NOT NULL ,chd_serial INTEGER NOT NULL ,hsc_respcode CHAR(2) NOT NULL ,scp_codeCHAR(4) NOT NULL ,imp_flag SMALLINT) but when I try to delete it with the following command: DROP SEQUENCE fa_ccpsholderscpt_hsc_serial_seq I get this error: sequence "fa_ccpsholderscpt_hsc_serial_se" does not exist I work with version 7.1.3 on Openserver 5.0.5, gcc 2.95.3 and send the SQL commands through the JDBC driver. Sample Code No file was uploaded with this report
pgsql-bugs@postgresql.org writes: > A Sequence is created automatically with the SQL command: > CREATE TABLE fa_ccpsholderscpt(hsc_serial SERIAL NOT NULL ,chd_serial INTEGER NOT NULL ,hsc_respcode CHAR(2) NOT NULL,scp_code CHAR(4) NOT NULL ,imp_flag SMALLINT) Okay, let's try it ... regression=# CREATE TABLE fa_ccpsholderscpt(hsc_serial SERIAL NOT NULL ,chd_serial INTEGER NOT NULL ,hsc_respcode CHAR(2)NOT NULL ,scp_code CHAR(4) NOT NULL ,imp_flag SMALLINT); NOTICE: CREATE TABLE will create implicit sequence 'fa_ccpsholderscp_hsc_serial_seq' for SERIAL column 'fa_ccpsholderscpt.hsc_serial' NOTICE: CREATE TABLE / UNIQUE will create implicit index 'fa_ccpsholderscp_hsc_serial_key' for table 'fa_ccpsholderscpt' CREATE > but when I try to delete it with the following command: > DROP SEQUENCE fa_ccpsholderscpt_hsc_serial_seq > I get this error: > sequence "fa_ccpsholderscpt_hsc_serial_se" does not exist Not surprising, because that's not what it's called. Check the NOTICE again. regards, tom lane
On Mon, 11 Feb 2002 pgsql-bugs@postgresql.org wrote: > BAZIN Nicolas (nbazin@ingenico.com.au) reports a bug with a severity of 1 > The lower the number the more severe it is. > > Short Description > Sequence cannot be deleted > > Long Description A Sequence is created automatically with the SQL > command: > CREATE TABLE fa_ccpsholderscpt(hsc_serial SERIAL NOT NULL ,chd_serial > INTEGER NOT NULL ,hsc_respcode CHAR(2) NOT NULL ,scp_code CHAR(4) NOT > NULL ,imp_flag SMALLINT) > > but when I try to delete it with the following command: > DROP SEQUENCE fa_ccpsholderscpt_hsc_serial_seq That's not the name of the sequence in question unless you've upped the number of characters in an identifier. The sequence appears to on my machine be named "fa_ccpsholderscp_hsc_serial_seq" because the name would have ended up being too long.