Subject | Firebird 2.5 - Alter table - drop default - bug or feature |
---|---|
Author | Maxi |
Post date | 2017-04-24T18:50Z |
Hi everyone,
I encountered strange behavior droping a column definition with default value.
The environment is Ubuntu 16.04 LTS 64 bits, Firebird version LI-V2.5.6.27020 (Firebird 2.5 SuperClassic)
I'll try to explain with an example. The statement sequence is:
1. Create the table
CREATE TABLE "SCHEMA_AUTHOR" ("ID" integer NOT NULL PRIMARY KEY, "NAME" varchar(255) NOT NULL, "HEIGHT" integer CHECK ("HEIGHT" >= 0))
2. Popultate with some data
INSERT INTO SCHEMA_AUTHOR (ID, NAME, HEIGHT) VALUES ('1', 'Anonimus1', NULL);
3. Alter the table
ALTER TABLE "SCHEMA_AUTHOR" ADD "SURNAME" varchar(15) DEFAULT 'surname default' NOT NULL
After step 3, I have a record with a new column with 'surname default' value into SURNAME field.
4. Drop default definition
ALTER TABLE "SCHEMA_AUTHOR" ALTER COLUMN "SURNAME" DROP DEFAULT
After step 4, the SURNAME field value is setting to empty string ('')
Is that the correct behavior ?
--
Maxi