Subject | Re: [firebird-support] NOT NULL constraint not being enforced by Firebird |
---|---|
Author | Antonio Galicia |
Post date | 2006-06-09T20:05:15Z |
On 6/9/06, dr_bentonquest <bentonquest@...> wrote:
I can't reproduce this error.
-----------------------------
CREATE TABLE PRUEBA(
ID INTEGER,
TEXTO VARCHAR(5),
DEDXTRA NUMERIC(9,2) DEFAULT 0 NOT NULL,
PERXTRA NUMERIC(9,2) DEFAULT 0 NOT NULL
);
INSERT INTO PRUEBA (ID, TEXTO) VALUES (1, 'A');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (2, 'BB');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (3, 'CCC');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (4, 'DDDD');
-----------------------------
Then:
SQL> select * from PRUEBA;
ID TEXTO DEDXTRA PERXTRA
============ ===== ============ ============
1 A 0.00 0.00
2 BB 0.00 0.00
3 CCC 0.00 0.00
4 DDDD 0.00 0.00
SQL> SHOW VERSION;
ISQL Version: LI-V1.5.3.4870 Firebird 1.5
Firebird/linux AMD64 (access method), version "LI-V1.5.3.4870 Firebird 1.5"
on disk structure version 10.1
SQL>
-----------------------------
--
Saludos,
Toño
----
http://agc.com.mx/antoniogc/blog
> Please note that the DEDXTRA and PERXTRA fields are not in the INSERTHi!
> field list. I tought they would receive the default value (a zero).
> Instead, I get null values on them, which I can easily confirm
> with a SELECT.
I can't reproduce this error.
> So, under which conditions would a 'not null' field accept nullI do this
> values? Using FB 1.5.3 for Linux.
-----------------------------
CREATE TABLE PRUEBA(
ID INTEGER,
TEXTO VARCHAR(5),
DEDXTRA NUMERIC(9,2) DEFAULT 0 NOT NULL,
PERXTRA NUMERIC(9,2) DEFAULT 0 NOT NULL
);
INSERT INTO PRUEBA (ID, TEXTO) VALUES (1, 'A');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (2, 'BB');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (3, 'CCC');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (4, 'DDDD');
-----------------------------
Then:
SQL> select * from PRUEBA;
ID TEXTO DEDXTRA PERXTRA
============ ===== ============ ============
1 A 0.00 0.00
2 BB 0.00 0.00
3 CCC 0.00 0.00
4 DDDD 0.00 0.00
SQL> SHOW VERSION;
ISQL Version: LI-V1.5.3.4870 Firebird 1.5
Firebird/linux AMD64 (access method), version "LI-V1.5.3.4870 Firebird 1.5"
on disk structure version 10.1
SQL>
-----------------------------
--
Saludos,
Toño
----
http://agc.com.mx/antoniogc/blog