Support Adding a New Not Null With Default Value - Functional Specifcation
See Also: Design Specifcation
Brief Description
Currently when a new NOT NULL column with DEFAULT value is added to a populated table using ALTER TABLE ... ADD statement in ISQL, the column is initialized to 0 or blank depending on the data type of the column. The default value is not used for the initialization. For example:
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 (c1) VALUES (1);
ALTER TABLE t1 ADD c2 INT DEFAULT 99 NOT NULL,
ADD c3 CHAR (10) DEFAULT USER NOT NULL;
Currently we get the following result:
SELECT * FROM t1; C1 C2 C3 ====== ====== ====== 1 0
If one trys to GBAK restore/create from the .gbk file, GBAK will wrongly issue the following messages:
gbak: ERROR: validation error for column C2, value "*** null ***" gbak: ERROR: warning --- record could not be found.
The correct result should be:
C1 C2 C3 ====== ====== ====== 1 99 BIETIE
This database should be GBAK restore/create able.
User Interface/Usability
- No new SQL syntax added.
- No GUI changes.
- 2 new error messages are introduced:
- isc_bad_default_value, can not define a not null column with NULL as default value, 335544759L
- isc_invalid_clause, invalid clause NOT NULL DEFAULT NULL, 335544760L
Reference Documents
SQLCODE | SQLCODE Text | InterBase# |
---|---|---|
-206 | can not define a not null column with NULL as default value | 335544759L |
-206 | invalid clause NOT NULL DEFAULT NULL | 335544760L |
Error Code | Number | Message |
---|---|---|
isc_bad_default_value | 35544759L | can not define a not null column with NULL as default value |
isc_invalid_clause | 335544760L | invalid clause NOT NULL DEFAULT NULL |