hi,
yes it is expected. you must:
1.add field with "default"
or
2. add field without not nullupdate table and set that field valueafter that 
change that field to not null
regards,Karol Bieniaszewski

-------- Oryginalna wiadomość --------
Od: Slavomir Skopalik <skopa...@elektlabs.cz> 
Data: 12.10.2016  02:32  (GMT+01:00) 
Do: For discussion among Firebird Developers 
<firebird-devel@lists.sourceforge.net> 
Temat: [Firebird-devel] FB3.0.1 - Impossible to alter table 

Hi all,

If I have a table that contains some rows, in FB3.0.1 is not possible to 
add new NOT NULL column.

Example:

ALTER TABLE Defects ADD idDefectType TLongInt NOT NULL;

COMMIT;

Cannot commit transaction:
unsuccessful metadata update.
Cannot make field IDDEFECTTYPE of table DEFECTS NOT NULL because there 
are NULLs present.

If I will try to set a value it will causes:

ALTER TABLE Defects ADD idDefectType TLongInt NOT NULL;
update Defects SET idDefectType=0;

Dynamic SQL Error.
SQL error code = -206.
Column unknown.
IDDEFECTTYPE.
At line 1, column 20.

Is it bug or is it expected?

Slavek


-- 
Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopa...@elektlabs.cz
http://www.elektlabs.cz



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to